Quantcast

Remove observations deemed influential by influential.measure

classic Classic list List threaded Threaded
3 messages Options
GL
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Remove observations deemed influential by influential.measure

GL
dbs is an existing dataframe. I fit a lm and looked at influential observations. I want now to delete the influential observations from dbs, fit another lm, and see how different the results are. What is the syntax to remove the influential observations from dbs?

fit <- lm(NI ~ PG + log(TG), data=dbs)
fit.influential.observations <- influence.measures(fit)

dbs.without.influential.observations <- ?????
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Remove observations deemed influential by influential.measure

David Winsemius

On Jun 29, 2010, at 1:10 PM, GL wrote:

>
> dbs is an existing dataframe. I fit a lm and looked at influential
> observations. I want now to delete the influential observations from  
> dbs,
> fit another lm, and see how different the results are. What is the  
> syntax to
> remove the influential observations from dbs?
>
> fit <- lm(NI ~ PG + log(TG), data=dbs)
> fit.influential.observations <- influence.measures(fit)
>
> dbs.without.influential.observations <- ?????
>

Look (more?) carefully at the examples on the help page. The first  
example shows how to extract a vector of row numbers associated with  
infuential cases. If you need help applying htat information to a  
dataframe using "[" then you probably need to re-read the Introduction  
to R as well.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
GL
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Remove observations deemed influential by influential.measure

GL
dbs_influential_obs <- which(apply(fit.influential.observations$is.inf, 1, any))
dbs_sans_influential_obs <- dbs1[-dbs_influential_obs,]
Loading...