##load the data
data(mesa.data.model)
##Compute dimensions for the data structure
dim <- loglike.dim(mesa.data.model)
##Find out in which order parameters should be given
loglike(NA,mesa.data.model)
##Let's create random vectors of values
x <- runif(dim$nparam.cov)
x.all <- runif(dim$nparam)
##Evaluate the log-likelihood for these values
loglike(x.all, mesa.data.model, "f")
loglike(x, mesa.data.model, "p")
loglike(x, mesa.data.model, "r")
##check that profile and full give the same results
data(mesa.data.res)
x.all <- mesa.data.res$par.est$res.best$par.all
x <- mesa.data.res$par.est$res.best$par
if( abs(loglike(x.all, mesa.data.model, "f") -
loglike(x, mesa.data.model, "p")) > 1e-8 ){
stop("loglike: full and profile not equal")
}
Run the code above in your browser using DataLab