By the way, how about:

plot(y,mylm$residuals)

So you can have an idea of your error distribution across your response
variable domain. :-)

milton
toronto=brazil
On Sat, Sep 19, 2009 at 9:02 PM, Sunil Suchindran <sunilsuchind...@gmail.com
> wrote:

> x <- seq(50)
>
> y <- 10 + x * 2 + rnorm(50,0,10)
>
> plot(y~x)
>
> mylm = lm(y~x)
>
> # Use str(mylm) to see how to get the residuals
>
> plot(x,mylm$residuals)
>
>
> On Sat, Sep 19, 2009 at 8:35 PM, Jason Priem <pr...@email.unc.edu> wrote:
>
> > Hi,
> > I want to plot the residuals of a least-squares regression.
> >
> > plot(lm(y~x), which=1)
> >
> > does this, but it plots the y-axis of my data on the x-axis of the
> > residuals plot.  That is, it plots the residual for each y-value in the
> > data.  Can I instead use the x-axis of my data as the x-axis of the
> > residuals plot, showing the residual for a given x?
> >
> > Thanks!
> >
> > Jason Priem
> > University of North Carolina at Chapel Hill
> > School of Information and Library Science
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> <http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to