Dear All I am trying to use svychisq with a two-dimensional table 4 x 5. The command I am using is summary(svytable(~dietperception+dietstatus,dudleyls1rake,na.rm=TRUE),"C hisq") It is throwing up an error message as follows: Error in NCOL(y) : only 0's may be mixed with negative subscripts In addition: Warning messages: 1: is.na() applied to non-(list or vector) in: is.na(rowvar) 2: is.na() applied to non-(list or vector) in: is.na(colvar) The dietperception data set does have some NA's where as there are none in dietstatus. The table is svytable(~dietperception+dietstatus,dudleyls1rake) dietstatus dietperception Good OK Poor Very Poor Unclassified Perceive healthy 6669.15287 6306.38635 47563.49174 80030.97096 12340.28453 Neither agree not disagree 250.68278 204.88193 6086.84308 35575.32925 2158.47668 Perceive unhealthy 0.00000 171.49710 2075.80230 26390.92946 318.73213 Don't know 0.00000 22.33107 334.44880 4402.99293 562.91532 I wondered if you could give me any idea where I am gong wrong. Many thanks Angela Dr Angela Moss Public Health Information Analyst Dudley PCT St. John's House Union Street Dudley DY2 8PP Tel: 01384 366091 Fax: 01384 366485 [[alternative HTML version deleted]]
On Fri, 18 May 2007, Moss, Angela (Dudley PCT) wrote:> Dear All > > I am trying to use svychisq with a two-dimensional table 4 x 5. The > command I am using is > summary(svytable(~dietperception+dietstatus,dudleyls1rake,na.rm=TRUE),"C > hisq") > > It is throwing up an error message as follows: > > Error in NCOL(y) : only 0's may be mixed with negative subscriptsI can't reproduce this problem at all. I've tried tables with zero cells, with and without raking. The na.rm= argument to svytable() can't be helping, since svytable() doesn't have an na.rm argument. Does the same thing happen if you call svychisq() directly rather than via summary(svytable())? -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle