Description Usage Arguments Value Author(s) See Also Examples
The function first uses solve.QP to find the best fitting estimates under the imposed constraints. Subsequently, it calculates the likelihood ratio for the constrained versus unconstrained model.
1 |
BKcov |
BKcov is the variance-covariance matrix of the model parameters. |
Q |
Q is a vector with the (unconstrained) model estimates. |
R |
A matrix defining the constraints under which we want to minimize the quadratic function. |
r |
vector holding the minimimum sum for each row in R. |
E |
Numeric. The first E constraints are treated as equality constraints, all further as inequality constraints. Default value = 0. |
llratio |
scalar, the value of the resulting likelihood ratio. |
M. A. J. Zondervan-Zwijnenburg
1 2 3 4 5 6 7 8 9 10 11 12 | data <- data.frame(y=ChickWeight$weight,g=ChickWeight$Diet)
aggregate(data$y,by=list(data$g),mean)
reg <- lm(data$y~data$g)
BKcov <- vcov(reg)
Q <- reg$coefficients
#b1=102, b3-b2>20, b3-b4>10, b4>30
R <- rbind(c(1,0,0,0),c(0,-1,1,0),c(0,0,1,-1),c(0,0,0,1))
r = c(102,20,10,30)
E = 1
llratio.f(BKcov=BKcov, Q=Q, R=R, r=r, E = E)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.