put the constrained predictor in the model offset ('offset' argument in 'lm'). i.e.: > set.seed(10) > X <- matrix(rnorm(20), 10, 2) > y <- X %*% c(1,2) + rnorm(10) > coef(lm(y ~ X[,2], offset=X[,1])) (Intercept) X[, 2] -0.8009112 1.6968198 > coef(lm(I(y-X[,1]) ~ X[,2])) (Intercept) X[, 2] -0.8009112 1.6968198
Antonio. 2006/11/1, John Gauss <[EMAIL PROTECTED]>: > Dear R users, > > Please excuse my inexperience. I am trying to contrain the coefficients of > my linear regression to equal one when using the <-lm(...) command. I've > searched "help(glm)" "help(model.offset)" etc. but I am unable to figure out > where to put this constraint. Your help would be greatly apprciated. > > Thanks. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.