# NOT RUN {
# set dimensions (p=covariates, n=individuals, T=time points)
p <- 3; n <- 12; T <- 10
# set model parameters
SigmaE <- diag(p)/4
A1 <- createA(p, topology="clique", nonzeroA=0.1, nClique=1)
A2 <- createA(p, topology="hub", nonzeroA=0.1, nHubs=1)
# generate data
Y <- dataVAR2(n, T, A1, A2, SigmaE)
## determine optimal values of the penalty parameters
# }
# NOT RUN {
optLambdas <- constrOptim(c(1,1, 1), loglikLOOCVVAR2, gr=NULL,
# }
# NOT RUN {
ui=diag(3), ci=c(0,0,0), Y=Y,
# }
# NOT RUN {
control=list(reltol=0.01))$par
# }
# NOT RUN {
# ridge ML estimation of the VAR(2) parameter estimates with
# optimal penalty parameters
optLambdas <- c(0.1, 0.1, 0.1)
ridgeVAR2(Y, optLambdas[1], optLambdas[2], optLambdas[3])
# }
Run the code above in your browser using DataLab