Hi folks, I am wondering if there is a way in R to fit logistic regression on contingency table. If I have original data, I can transform the data into a design matrix and then call glm to fit the regression. But now I have a 2x3 contingency table with first row for response 0 and second row for response 1, and the columns are 3 levels of predictor variable. The 3 levels are not ordinal though and indicator variables would be more appreciate. Thanks a lot! Bingshan
Bingshan Li <bli1 <at> bcm.tmc.edu> writes:> I am wondering if there is a way in R to fit logistic regression on > contingency table. If I have original data, I can transform the data > into a design matrix and then call glm to fit the regression. But now > I have a 2x3 contingency table with first row for response 0 and > second row for response 1, and the columns are 3 levels of predictor > variable. The 3 levels are not ordinal though and indicator variables > would be more appreciate.>From Documentation of GLM:For binomial and quasibinomial families the response can also be specified as a factor (when the first level denotes failure and all others success) or as a two-column matrix with the columns giving the numbers of successes and failures. .... Dieter Menne