On Fri, 5 Mar 2004, Andrew Criswell wrote: > I have a binomial model with one covariate, x1, treated as a factor with > 3 levels. The other covariate is measured x2 <- 1:30. The response, y, > is the proportion of successes out of 20 trials. > > glm(cbind(y, 20 - y) ~ x1 * x2, family = binomial) > > Now, I would like to constrain the cofficients on 2 levels of the > factor, x1, to be identical and test the difference between these models > by a likelihood ratio test. > > How can I get glm() to constrain the coefficients on 2 levels to be the > same?
Merge the levels of the factor: see ?levels. You could also set up a custom contrasts matrix: either way the natural S approach is to reparametrize rather than constrain. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html