ezANOVA - factor treated as numeric variable

1,256 views
Skip to first unread message

Friederike H

unread,
Oct 7, 2015, 9:44:04 AM10/7/15
to ez4r
Hi all,

I'm new to R (converted from SPSS), and just trying to master repeated measures ANOVA.

When I'm using ezANOVA, I get the following warning messages:
> myModel<-ezANOVA(data = longdata, dv = .(dv), wid = .(iv),  within = .(time), detailed = FALSE, type = 2)
Warning: Converting "iv" to factor for ANOVA.
Warning: "time" will be treated as numeric.
Warning: There is at least one numeric within variable, therefore aov() will be used for computation and no assumption checks will be obtained.

I realize that there are threads on this issue already, but I simply cannot figure out how to prevent this from happening.
I have defined "time" as a factor, it has three levels.

> time<-factor(time, levels=c(1,2,3), labels=c("pre","while","post"))

This is why ezANOVA would actually be helpful, providing Mauchly's Test and Shpericity Corrections.
Can anybody help with this issue? I followed Andy Field's "Discovering Statistics Using R" Book when preparing the data and changing the data frame to long format.

Thanks,
Friederike

Mike Lawrence

unread,
Oct 7, 2015, 9:46:29 AM10/7/15
to ez...@googlegroups.com
You need to change time column to a factor in the data frame itself:

longdata$time<-factor(longdata$time, levels=c(1,2,3), labels=c("pre","while","post"))
--
You received this message because you are subscribed to the Google Groups "ez4r" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ez4r+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

--
Mike Lawrence
Graduate Student
Department of Psychology & Neuroscience
Dalhousie University

~ Certainty is (possibly) folly ~

Friederike H

unread,
Oct 7, 2015, 9:58:21 AM10/7/15
to ez4r
It works! Thank you for the solution and also for the quick answer, I spent all day trying to figure this out!


Am Mittwoch, 7. Oktober 2015 15:46:29 UTC+2 schrieb Mike Lawrence:
You need to change time column to a factor in the data frame itself:

longdata$time<-factor(longdata$time, levels=c(1,2,3), labels=c("pre","while","post"))

On Wednesday, October 7, 2015, Friederike H <friederike...@gmail.com> wrote:
Hi all,

I'm new to R (converted from SPSS), and just trying to master repeated measures ANOVA.

When I'm using ezANOVA, I get the following warning messages:
> myModel<-ezANOVA(data = longdata, dv = .(dv), wid = .(iv),  within = .(time), detailed = FALSE, type = 2)
Warning: Converting "iv" to factor for ANOVA.
Warning: "time" will be treated as numeric.
Warning: There is at least one numeric within variable, therefore aov() will be used for computation and no assumption checks will be obtained.

I realize that there are threads on this issue already, but I simply cannot figure out how to prevent this from happening.
I have defined "time" as a factor, it has three levels.

> time<-factor(time, levels=c(1,2,3), labels=c("pre","while","post"))

This is why ezANOVA would actually be helpful, providing Mauchly's Test and Shpericity Corrections.
Can anybody help with this issue? I followed Andy Field's "Discovering Statistics Using R" Book when preparing the data and changing the data frame to long format.

Thanks,
Friederike

--
You received this message because you are subscribed to the Google Groups "ez4r" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ez4r+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages