s-news
[Top] [All Lists]

predict.lm() - Seems not to accept the dataframe parameter

To: s-news@lists.biostat.wustl.edu
Subject: predict.lm() - Seems not to accept the dataframe parameter
From: Silent Killer <thesilentkiller@gmail.com>
Date: Sat, 23 Apr 2005 19:32:16 -0400
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; b=i+919DCN73srKydT18YLN9PlRZahOtZ7XzXDWm7Ed+wQ9zeJJqFE8/sdTap3LCrzVvfXnAxCES6992ocktYwcDtuM2PxhdL3bqfglu9YWwX1HIIVdFzM2PZs83sjlGOI/sD1PXiTNvqwt9/502Z+2JwsF72UxQGcE0zvkdgsUqM=
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)
Hi all,

I am using "S-PLUS® 6.2 for Windows STUDENT EDITION" to perform mathematical analysis. I am a little confused with the use of the predict command.

I have constructed a model using dataset1. Now I want to use the model to predict a new data set - dataset2. I am not able to use the predict command properly. Here is what I have done so far...

(1) Created the model using dataset1

Poly1_lm(formula = dataset1$Var1 ~ poly(dataset1$Var2, 40) + poly(dataset1$Var3, 40), singular.ok = T)

(2) Now tried using Poly1 (the model) to predict values on dataset1. This should give me the fit on the same data used for modeling

data1_predict.lm(Poly1, dataset1)

(3) Now tried using Poly1 to predict values on dataset2. This should give me the predicted results on the new set of data.

data2_predict.lm(Poly1, dataset2)


What I find confusing is, data1 and data2 are identical. It is as if the command did not accept the dataset parameter. I tried predict.lm(object = Poly1, df = dataset2). Same effect. No errors. It just uses dataset1, irrespective of whatever I do. If I give an invalid name for the second parameter "predict.lm(Poly1, dataset3), it gives an error saying it can't find object dataset3.

Can someone help me out?

Thanks,
SK

<Prev in Thread] Current Thread [Next in Thread>
  • predict.lm() - Seems not to accept the dataframe parameter, Silent Killer <=