I cannot figure out what I am doing wrong when I run this Analysis of Variance. It is only producing 6 out of the nine factors I need for TypeBeat. Any help is greatly appreciated.
EX1HW5 data:
TypeBeat
Course.Time.In.Hours
Score.A
Score.B
Score.C
upper.class
5
34.4
35.5
39.2
middle.class
10
30.2
32.4
34.7
inner.city
15
20.1
39.4
54.3
My R-code:
Course <- aov(Course.Time.In.Hours ~ TypeBeat+Score.A + Score.B+Score.C, data = EX1HW5)
Course
Course.2<-aov(Course.Time.In.Hours ~ TypeBeat*Score.A+Score.B+Score.C, data = EX1HW5)
Course.2
R-Output:
3 out of 6 effects not estimable
Estimated effects may be unbalanced
5 out of 8 effects not estimable
Estimated effects may be unbalanced
I do not understand why you posted the long message about reprex. However, I apologize for any inconvenience or annoyance (as that was not my intention).
Here are the answers to your questions.
EX1HW5 is the same as the data included in the post (maybe I should have called it that rather than my data. I understand the confusion with the data name in the code).
I thought I kept my codes and comments reasonably short, easy to read and copy.
It is just the basic R package used (honestly, I thought that one was a given).
We can't run the code because we don't know what the data structure is. Read the article. It will make it more likely that someone will be able to give you an answer.
I did read the article. The data structure is what is up there. This data is all my professor provided for us. We are supposed to use it to run an Analysis of Variance and create an interaction plot. Unfortunately, he did not give us a dataset. I am so exhausted from trying to figure this out.
Basically we need a good sized sample of your data and the artcle s suggests various ways to provide it. Since we probably only need the data a handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.
General Inquiry
Multicolinearity or would R specifically warn of this? I thought it did.
Thank you for all of your help, William. I do appreciated it. I apologize for not having enough information, but that was all I was given. Thanks again!
Normally you would have a larger dataset and you would be able to analyse the variance between the groups. It is pretty hard to do an anova with only one observation in each group (TypeBeat).
This is the issue. With only one observation per level of TypeBeat, it is not possible to fit this model. R is automatically dropping some of the predictors because with them, the matrix is singular.
To address, you might simulate some fake data to fit the models on.
Its always dangerous playing data analysis on source data that is not understood, what the column/rows represent etc. it becomes a bit of a guessing game based on such assumptions.
If what you show is all that you have then the data cannot be analyzed. The problem is that you have more variables than data. You are trying to estimate five variables using three observations. The second problem is that this is a mixed model with one categorical variable (typebeat) and three continuous variables (score.A, score.B, score.C). The latter issue is solvable, the former is a critical fail. Working out the degrees of freedom in the ANOVA may help you see part of the issue. That said, it is odd for an instructor to give students an unsolvable problem. I would reread the question, and I would double check to make sure that I had all the data correctly entered into R. I would check to make sure that you have the correct model. If everything check out, then I would contact the instructor (or TA) and ask for clarification.
An observation: The first model has no interaction terms. The model has four variables stated with the error term implied (five variables). I am not sure how R gets 6 effects.
You are correct. My instructor forgot to give us the complete dataset. This was brought to his attention by several students, including me. Thank you so much for your assistance!