Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ezANOVA() fails for unbalanced completely between-Ss design #1

Closed
mike-lawrence opened this issue Feb 9, 2011 · 5 comments
Closed

Comments

@mike-lawrence
Copy link
Owner

This bug is in version 3.0-0. Reproducible example:

data(ANT)
ANT=ANT[ANT$subnum!=ANT$subnum[1],]
ezANOVA(ANT,.(rt),.(subnum),between=.(group))
Warning: You have removed one or more Ss from the analysis. Refactoring "subnum" for ANOVA.
Warning: Data is unbalanced (unequal N per group). Make sure you specified a well-considered value for the type argument to ezANOVA().
Error in names(x) <- value :
'names' attribute [8] must be the same length as the vector [7]
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within, :
The car::Anova() function used to compute results and assumption tests seems to have failed. Most commonly this is because you have too few subjects relative to the number of cells in the within-Ss design. It is possible that trying the ANOVA again with "type=1" may yield results (but definitely no assumption tests).

@mike-lawrence
Copy link
Owner Author

Error stems from the fact that car::Anova has changed recently and now returns an object with a $terms value when there are within-Ss variables in the model but not when there are only between-Ss variables. This is easily obviated by replacing

nterms <- length(object$terms)

with

nterms <- ifelse(is.null(object$terms),dim(object)[1]-1,length(object$terms))

in ezANOVA_summary.

I will include this fix in version 3.0-1.

@michaelhallquist
Copy link

Hi Mike,

Great package! I ran into this bug recently, too. In addition to changing the nterms line, you need to change the line that sets the names of the effects.

old:
table3[, 1] <- table2[, 1] <- table[, 1] <- object$terms

new:
table3[, 1] <- table2[, 1] <- table[, 1] <- ifelse(is.null(object$terms),row.names(object),object$terms)

Playing around further, however, the summary function seems to breakdown in my simple between-subjects case because the object has no SSP or SSPE elements. Probably some deeper change in the Anova function?

Anyway, good luck patching these changes. I'm eager for ez to be working again.

Best,
Michael

@mike-lawrence
Copy link
Owner Author

As Michael points out, the solution turns out to be more complex. I posted the final fix to the mailing list (http://groups.google.com/group/ez4r/attach/d4c3bc52f34ea4d1/ez-internal.R)

@egorananev
Copy link

Hello Mike,

Was this issue ever resolved?

Thanks,
--Egor

@mike-lawrence
Copy link
Owner Author

Ah, yes it was resolved, I simply failed to close the issue. Thanks for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants