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

problem running unbalanced repeated measures anova #134

Open
pavlo888 opened this issue Nov 8, 2021 · 0 comments
Open

problem running unbalanced repeated measures anova #134

pavlo888 opened this issue Nov 8, 2021 · 0 comments

Comments

@pavlo888
Copy link

pavlo888 commented Nov 8, 2021

Hi,

I am having problems running an unbalanced repeated measures anova.

I have about 180 samples and my data looks like this:

  id    Subject_ID Sampling_time Sampling_site GH_name    GH    Diagnostic Diagnostic_new GH_new  shannon_entropy
  <chr> <chr>      <fct>         <chr>         <chr>      <chr> <fct>      <chr>          <chr>             <dbl>
1 1-10A 28         1             start         Van_Lommel 10    Healthy    NA             GH_10_H            3.72
2 1-10B 29         1             middle        Van_Lommel 10    Healthy    NA             GH_10_H            2.53
3 1-10C 30         1             end           Van_Lommel 10    Healthy    NA             GH_10_H            2.58
4 1-11A 31         1             start         Smets      11    Healthy    NA             GH_11_H            5.17
5 1-11B 32         1             middle        Smets      11    Healthy    NA             GH_11_H            6.38
6 1-11C 33         1             end           Smets      11    Healthy    NA             GH_11_H            4.61 

Then I am running the following command:

metadata_w_shannon %>%
  anova_test(
    dv = shannon_entropy,
    wid = id,
    between = Diagnostic,
    within = Sampling_time, 
    type = 3 #for unbalanced design
    )

But then I get the following error:

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

However both the between and within columns are factors.

Any idea what might be wrong?

Cheers,
Pavlo

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

No branches or pull requests

1 participant