Re: [R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Thanks Josh. The variance of predictor should be var(beta_0+beta_1*newdata+epsilon). It is actually the variance of dependent variable if we plug the concrete value of independent variable into the model. On Mon, Sep 27, 2010 at 2:09 PM, Joshua Wiley wrote: > Hi, > > Try this: > > # using the

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Joshua Wiley
Hi, Try this: # using the iris dataset mydat <- iris mymodel <- lm(Sepal.Length ~ Petal.Length + Species, data = mydat) summary(mymodel) newdat <- data.frame(Petal.Length = seq(1, 10, by = .1), Species = factor(rep("virginica", 91))) results <- predict(object = mymodel, newd

[R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Hi folks, I use lm to run regression and I don't know how to predict dependent variable based on the model. I used predict.lm(model, newdata=80), but it gave me warnings. Also, how can I get the variance of dependent variable based on model. Thanks. [[alternative HTML version deleted]]