[R] Using predicted() in R

flokke flokke at live.de
Mon Oct 24 20:45:12 CEST 2011


Dear all, 
I am a R user since about 3 weeks now and still struggeling with things that
must be very 
easy for you...
This week I am struggling with the function predict()

I want to use this function to get a 95% interval. 
I understand that you have to use it in such a way as: 

lm_examplemodel<- lm(y~x1 + x2 + x3)
newdata <- data.frame(x1 = ???, x2 = ???, x3 = ???)
predict(lm_examplemodel, newdata, interval = 'confidence')

 And here comes my questions. As you maybe already have guessed its about
the questions marks/
the values for the new data frame you have to use. 

I read in help(predict.lm) that you have to use a new data frame to be able
to use the predict 
function, but I dont know what values I have to assign to x1 and x2 ... to
create the new data set.
In the help function it says that you can use the fitted values, but when I
use the function: 

fitted(lm_examplemodel)
or fitted.values(lm_examplemodel)

I get many many columns. I think that the function gives a fitted value for
every Yi and Xi. 
SO how do I get those values? Do i have to use another function than fitted?
Or not the fitted 
values at all?


Thanks already so much!
Cheers,maria

--
View this message in context: http://r.789695.n4.nabble.com/Using-predicted-in-R-tp3934150p3934150.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list