s-news
[Top] [All Lists]

[S] predict.gam() question

To: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Subject: [S] predict.gam() question
From: "Piotrovskij, Vladimir [JanBe]" <VPIOTROV@janbe.jnj.com>
Date: Sun, 20 Jun 1999 11:14:04 +0200
Sender: owner-s-news@wubios.wustl.edu
Dear S-plus users,

I am trying to use predict.gam() for imputation. I type the following:
 fit.gam _ gam(WT~s(AGE)+SEX,data=y,na.action=na.omit)
 predict.gam(fit.gam,newdata=y[is.na(y$WT),c("AGE","SEX")])

and I get an error message:
   Warning in x * w.factor: Length of longer object is not a multiple of the
length of the shorter object
 Error in names<-: Invalid length for names attribute: y = structure(..
 Dumped

The same happens if I type
 predict(fit.gam,newdata=y[is.na(y$WT),c("AGE","SEX")])

However, with lm predict() works fine:
 fit.lm _ lm(WT~AGE+SEX,data=y,na.action=na.omit)
 predict(fit.lm,newdata=y[is.na(y$WT),c("AGE","SEX")])
       235      239      879      782 
  70.21978 82.96362 81.23095 67.47638
whereas predict.gam() does not:
 predict.gam(fit.lm,newdata=y[is.na(y$WT),c("AGE","SEX")])
   Warning in x * w.factor: Length of longer object is not a multiple of the
length of the shorter object
 Error in names<-: Invalid length for names attribute: y = structure(..
 Dumped

What is wrong?

I use S-plus 4.0 for Win release 2.

Thanks in advance

Vladimir
vpiotrov@janbe.jnj.com

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] predict.gam() question, Piotrovskij, Vladimir [JanBe] <=