Re: [R] predicting values from multiple regression

2011-03-21 Thread Anna Lee
Dennis: thank you so much! I got it now and it works just perfectly. Thanks a lot to the others too! Anna 2011/3/21 Dennis Murphy : > Hi: > > To amplify Ista's and David's comments: > > (1) You should not be inputting separate vectors into lm(), especially if > you intend to do prediction. They sh

Re: [R] predicting values from multiple regression

2011-03-21 Thread Anna Lee
Dennis: Thank you so much! I got it now - it just works perfectly. Thanks a lot! Anna 2011/3/21 Dennis Murphy : > Hi: > > To amplify Ista's and David's comments: > > (1) You should not be inputting separate vectors into lm(), especially if > you intend to do prediction. They should be combined int

Re: [R] predicting values from multiple regression

2011-03-20 Thread Ista Zahn
Hi Anna, Maybe you can start again and tell us what you are trying to accomplish. If you are trying to calculate predicted values for the cases in the data set used to fit the model you don't need the newdata argument at all. Just do predict(model9) If you are trying to do something else, please

Re: [R] predicting values from multiple regression

2011-03-20 Thread David Winsemius
On Mar 20, 2011, at 3:56 PM, Anna Lee wrote: Dear Ista! Thank you for replying. The point you made is exactly what's the problem: I want to predict the values at different points in space. calP stands for the water content at each sampling point (n=90) but I don't quite understand what R does.

Re: [R] predicting values from multiple regression

2011-03-20 Thread Anna Lee
Dear Ista! Thank you for replying. The point you made is exactly what's the problem: I want to predict the values at different points in space. calP stands for the water content at each sampling point (n=90) but I don't quite understand what R does. calP is my vector of measured data and I thought

Re: [R] predicting values from multiple regression

2011-03-20 Thread Ista Zahn
Hi Anna, On Sun, Mar 20, 2011 at 2:54 PM, Anna Lee wrote: > Hey List, > > I did a multiple regression and my final model looks as follows: > > model9<-lm(calP ~ nsP + I(st^2) + distPr + I(distPr^2)) > > Now I tried to predict the values for calP from this model using the > following function: > >

[R] predicting values from multiple regression

2011-03-20 Thread Anna Lee
Hey List, I did a multiple regression and my final model looks as follows: model9<-lm(calP ~ nsP + I(st^2) + distPr + I(distPr^2)) Now I tried to predict the values for calP from this model using the following function: xv<-seq(0,89,by=1) yv<-predict(model9,list(distPr=xv,st=xv,nsP=xv)) The pr