[R] what's interesting to plot after predict.lm?
David Winsemius
dwinsemius at comcast.net
Wed Mar 23 20:02:55 CET 2011
On Mar 23, 2011, at 12:04 PM, agent dunham wrote:
> Dear all,
>
> I've fitted this model with train data
>
> lms <- lm(vd ~ log(v1) + fv2+ fv5+ fv7 )
>
> and predicted over test data using
>
> plms <- predict.lm(lmsub, new=test,interval="predict",
> level=0.95,se.fit=TRUE)
>
> I've two questions:
>
> q1: what's the difference between writing interval "predict" or
> "confidence"
> ? How are they computed?
The source is readily accessible.
> Any reference would be appreciated
Any basic regression text should cover that topic. I know that Rosner
did in its second edition 25 years ago and it's only a basic
biostatistics text. I suspect you will also find that some of the
contributed documentation has this covered. Wikipedia is not bad either.
cran.r-project.org/other-docs.html
>
> q2: What's interesting to plot? I've gone through another post, and
> have
> seen the following:
>
> (http://r.789695.n4.nabble.com/help-with-predict-and-plotting-confidence-intervals-td886399.html
> )
> plot( seq(0,6, length.out = 24), plmsub[ ,"fit"] )
> lines(seq(0,6, length.out = 24), plmsub[ ,"lwr"],
> lty=2)
> lines(seq(0,6, length.out = 24), plmsub[ ,"upr"],
> lty=2)
> But I don't know what to plot with my multiple linear regression.
It sounds like you need to read even more in an introductory text than
just the section on the different between prediction and confidence
intervals.
>
> I also tried plot(plms) but I guess it doesn't have too much sense
In my earlier reply I suggested it might not be what you expected, but
I did not say the result would be nonsense.
>
> Maybe test$vd vs plms$fit? (if this was correct, what's the
> syntax to
> get the fit column of plms? )
You have three choices
-- to look at the structure of the lm-object with str()
-- read the help(lm) page and note the contents in the Value section
-- read the help(lm) page and identify the functions that will
extract the feature of interest.
(The list is not the place to be asking questions about basic
statistics questions.)
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list