I am trying to run a Tukey test in order to determine how total income state tax differs across political parties of governor after conducting my ANOVA test. However, when input the Tukey test code it comes up with an error message saying "no applicable method for 'TukeyHSD' applied to an object of class "data.frame"".
I have attached my code would anyone be able to help me with this?
Thanks,
The Fit_aov line of code works however when I tried the tukey_result line it came up with an error saying "Error in TukeyHSD.aov(Fit_aov) : no factors in the fitted model"
As I mentioned in another thread (Help with a hypothesis test),
your aov() is testing whether govparty_a is predicted by aiinct. That seems backwards. Don't you want to test if aiinct is predicted by govparty_a? If so you need to change the formula in aov() to aiinct ~ govparty_a.
You're right apologies that was my mistake. I have swapped them round in the aov() formula however for some reason it still does not let me run the tukeyHSD command and comes up with the same error.
My first guess is that govparty_a is not a factor. You can check that with class(incone_aov$govparty_a). If it is not a factor, you can make it one with
Could it be that there are some values in govparty_a which are not a 1 or a 0. I knew this might present an issue somewhere but could not figure out how to remove them or assign them to one of the values.