Walker Scott Pedersen
2020-Dec-23 16:05 UTC
[R] cooks distance for repeated measures anova
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]]
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 at 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 at 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.