Coefplot for a chi square distribution

58 Views Asked by At

I was told to do a coefplot in R to visualise my data better.

Therefore i first did a chi square test. and after i put my data into a table it looked like this:

                    1  2  3  5  6
 5_min_blank        11 21 18 19  8
 Boldstyle           6  7 14 10  2
 Boldstyle_pause     9 22 19  8  0
 Breaststroke        7 16 10  5  4
 Breaststroke_pause  9 13 10  8  3
 Diving             14 20 10 10  4

1-6 are categories and "bold style" etc. are different sounds.

i than did a test:

    fit.swim<-chisq.test(X2,simulate.p.value = TRUE, B = 10000)

and got this result:

Pearson's Chi-squared test with simulated p-value (based on 10000 replicates)

data:  X2
X-squared = 87.794, df = NA, p-value = 0.09479

Now i would like to do a coefplot with my data but i only get this error:

  coefplot(fit.swim)  
Error: $ operator is invalid for atomic vectors  

Any ideas how to draw a nice plot?

Thank you very much for the help!

All the best

Marie

1

There are 1 best solutions below

1
On BEST ANSWER

I think that the reason you are getting that error is because coefplot requires a fitted model as input in the form of an lm, glm or rxLinMod obj.

In your case you have carried out a goodness of fit test that essentially compares the observed sample distribution with the expected probability distribution. There isn't a fitted model to plot the coefficients from.