[R] How to predict the mean and variance of the dependent variable after regression
jwiley.psych at gmail.com
Mon Jun 21 20:34:28 CEST 2010
If you just want the mean and variance of log(y) try:
if there is missing data, you can add na.rm=TRUE to both of those. If
you want the mean and variance of the predicted ys
?predict.lm #the specific method being used for predict() with model
objects of class lm
On Mon, Jun 21, 2010 at 11:24 AM, Yi <liuyi.feier at gmail.com> wrote:
> Hi, folks,
> As seen in the following codes:
> y=rlnorm(10,mean=10)### Fake dataset
> After the regression, I would like to know the mean of y. Since log(y) is
> normal and y is lognormal, I need to know the mean and variance of log(y)
> first. I tried mean (y) and mean(linmod), but either one is what I want.
> Any tips?
> Thanks in advance!
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
University of California, Los Angeles
More information about the R-help