clm | R Documentation |
clm
(constrained linear model) is used to fit linear models under
constraints on the coefficients. It uses quadratic programming to run a
regression on data with a specified formula, subject to the constraint that
the coefficients of the regression sum to 1 (in the future could support
arbitrary constraints on the coefficients).
clm(formula, data, ...)
formula |
An object of class " |
data |
A data frame (or object coercible by
|
... |
Further arguments passed to or from other methods. |
clm
returns an object of class
"clm
". An object of class "clm
" is a list containing at least
the following components:
solution | a vector of coefficients for the constrained solution |
unconstrined.solution | a vector of coefficients for the unconstrained solution |
formula | the formula passed clm |
lm
, solve.QP
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
df <- data.frame(weight = c(ctl, trt), group = c(rep(0, 10), rep(1, 10)))
lm.D9 <- clm(weight ~ group, df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.