set.seed( 42 )
n <- 5
P1 <- 5
X1 <- diag(P1) %x% rep(1,n)
X2 <- as.matrix( rep(1,P1) %x% runif(n , 0,2) )
U <- rep(1,P1) %x% diag(n)
X <- as.matrix( cbind(X1,X2) )
tsq <- 1
ssq <- 0.7
Nks <- dim(X1)[1]
Qs <- dim(U)[2]
xi <- rnorm( sum(Qs) , 0 , rep(sqrt(tsq) , Qs) )
ep <- rnorm( sum(Nks) , 0 , rep(sqrt(ssq) , Nks) )
thetas <- c(2 , 3 , 3, 3 , 4 , 2 )
Y <- X%*%thetas + U%*%xi + ep
const <- list(order='simple' , decreasing=FALSE)
args(constrained.lme)
# Note that 'nsim' has been reduced for illustration
clme.out1 <- constrained.lme( method='QPE', Y=Y, X1=X1, X2=X2, U=U,
constraints=const, nsim=10 , tsf=lrt.stat )
clme.out2 <- constrained.lme( method='PAVA', Y=Y, X1=X1, X2=X2, U=U,
constraints=const , nsim=10 )
# Let program estimate the order ('constraints' not specified)
# Takes longer to run
clme.out3 <- constrained.lme( method='PAVA', Y=Y, X1=X1, X2=X2, U=U,
nsim=10 , em.eps=0.0001)
Run the code above in your browser using DataLab