[18820] in s-news-athena

home help back first fref pref prev next nref lref last post

[S] summary:predict()

daemon@ATHENA.MIT.EDU (fan@katan.cybercom.net)
Mon Aug 2 16:56:20 1999

From: fan@katan.cybercom.net
Date: Mon, 2 Aug 1999 16:51:37 -0400 (EDT)
To: s-news@wubios.wustl.edu
Message-Id: <Pine.LNX.4.04.9908021644080.2247-100000@katan.cybercom.net>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


Regarding my previous posting of a simple grammar usage on
predict() for regression model, in summary:
  1. the new data should be in "data.frame" mode. The data.frame()
    function must be used when necessary. 
  2. the argument of the data.frame() function must specify variable
    name.

It looks that the standard grammar for predict() should not be reduced in
any way. Thank to all who replyed.

Original question:
>#Example: regression
>a<-1:10
>b<-a+rnorm(10)
>mod <- lm(b~a)
> #what's the prediction when x=11?
>predict(mod, 11) #but I get 10 fitted values
>predict(mod, data.frame(11)) #still 10 values
>
>#multivariate regression
>a2<-a^2
>mod <- lm(b~cbind(a,a2))
>#next several lines give errors
>predict(mod, c(10,20)) 
>predict(mod, data.frame(10,20))
>predict(mod, data.frame(c(10,20)))





-----------------------------------------------------------------------
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

home help back first fref pref prev next nref lref last post