[R] cooks distance for repeated measures anova

Tom Woolman twoo|m@n @end|ng |rom ont@rgettek@com
Wed Dec 23 17:29:17 CET 2020

Hi Dr. Pedersen.

I haven't used cook's on an aov object but I do it all the time from  
an lm (general linear model) object, ie.:

mod <- lm(data=dataframe)
cooksdistance <- cooks.distance(mod)

I *think* you might be able to simulate an aov using the lm functon by  
selecting the parameter in lm to calculate the type 1 sum of squares  
error that would be provided by the aov function.

FYI I'm using Cook's in my case as part of an anomaly detection engine  
based on a linear model interaction.

Quoting Walker Scott Pedersen <wsp using uwm.edu>:

> Hi all,
> Is there a way to get cook's distance for a repeated measures anova?  
> Neither cooks.distance or CookD from the predictmeans package seem  
> to allow for this.  For example, if I have the model
> data(iris)
> mod<-aov(Sepal.Length  ~ Petal.Length + Petal.Width +  
> Error(Species), data=iris)
> both
> cooks.distance(mod)
> and
> library(predictmeans)
> CookD(mod, group=Species)
> give an error saying they don't support an aovlist object.
> I would prefer a method to get a cook's distance for each category  
> in my repeated factor (i.e. Species), rather than each observation.
> Thanks!
> --
> Walker Pedersen, Ph.D.
> Center for Healthy Minds
> University of Wisconsin -- Madison
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

More information about the R-help mailing list