The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

woko (1) [Avatar] Offline
I have created the table on page 158:

treatment <- rep(c("Placebo", "Treated"smilie, each=6)
improved <- rep(c("None", "Some", "Marked"smilie, times=2,each=2)
sex <-rep(c("female","male"smilie,times=6)
Freq <- c(19,10,7,0,6,1,6,7,5,2,16,5)
mytable <-, improved,sex, Freq))

When I now use the table2flat function, I get a data frame mydata with 69 observations (rows). But I would expect 84 cases (rows). When I try the same with the data in table 7.2, I get 20 rows in mydata. Also here I would expect 84 rows.

Consequently I get different statistics from page 157 (bottom) when I use the assocstats(mytable) function:
mytable2 <-xtabs(~treatment+improved, data=mytable)

X^2 df P(> X^2)
Likelihood Ratio 1.2900 2 0.52467
Pearson 1.2749 2 0.52864

Phi-Coefficient : 0.136
Contingency Coeff.: 0.135
Cramer's V : 0.136

Is there a mistake in my thinking? Do I something wrong?