[R] linear regression, exclude a datum

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Sep 14 15:57:46 CEST 2009


Hi,

On Sep 14, 2009, at 9:47 AM, e-letter wrote:

> Readers,
>
> I have been reading the r book (Crawley) and tried to use the
> influence measures function for linear regression, as described. I
> have one datum that I wish to show in the graph but exclude from the
> regression and ab line.
>
> x	y
> 0	5
> 10	9
> 20	10
> 30	19
> 40	4
>
> With the influence measures function I plot the graph but linear
> regression includes the datum (40,4), which I want to show on the
> graph but exclude from the linear regression ab line.
>
> Is there an alternative package to perform this task please?

Please post the code you're using to try and do the regression.

I think you simply want to remove the data point when you build the  
regression model, then plot it later after you plot the regression.

Something like:

model <- lm(y ~ x, data=my.data[-5,])
... plotting stuff ...

If that doesn't make sense to you, please post some code we can  
comment on.

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list