Friday, February 9, 2007
Marginal distribution of two-way tables
Well, I have been working through this section in the hope that it will enlighten me on performing chi-square analyses when we get to it later in the book. However, I have been getting alot of error messages from codes typed directly from the book, which has been pretty frustrating. Has anyone worked through the example on 3.1.3. When I type in x for some reason it will not display the entire array, so that when I try to calculate the sum for the rows I get error messages. I just wondered if anyone else had this problem, or whether it is just me, ARGH!!!!
Subscribe to:
Post Comments (Atom)
2 comments:
Hey Heidi,
Here's what I typed in, and it worked for me. Try cutting and pasting the following lines (cut and paste each line at a separate prompt - i.e., hit "Enter" in between):
x=matrix(c(56,2,8,16),nrow=2)
rownames(x)=c("buckled","unbuckled")
colnames(x)=c("buckled","unbuckled")
margin.table(x,1)
margin.table(x,2)
addmargins(x)
Here's what I ended up with:
buckled unbuckled Sum
buckled 56 8 64
unbuckled 2 16 18
Sum 58 24 82
Good luck!
Nicole :)
Heidi,
Did you ever get this to work? I was wondering if this was one of those problems associated with having to attach the data.
Rebecca
Post a Comment