Evaluate likelihood function for specific parameters in nlme

20 views Asked by At

Suppose I have a fitted gnls model (I am also interested in solutions that could apply to nlme model objects). Is there a way to evaluate the likelihood at a specified set of parameters without having to implement the likelihood function from scratch?

For example, suppose I have the following model:

library(nlme)

mod1 <- gnls(distance ~ a, 
            data = Orthodont,
            param = a ~ age,
            start = c(16, 0.5),
            correlation = corSymm(form = ~ as.numeric(factor(age)) | Subject),
            weights = varIdent(form = ~ 1 | age))

> logLik(mod1)
'log Lik.' -215.8539 (df=12)

I can fit a model with fixed variance-covariance parameters and compute the likelihood

mod1fix <- gnls(distance ~ a, 
                data = Orthodont,
                param = a ~ age,
                start = c(16, 0.5),
                correlation = corSymm(value = rep(0, 6), form = ~ as.numeric(factor(age)) | Subject, fixed = TRUE),
                weights = varIdent(form = ~ 1 | age, fixed = c(`10` = 1, `12` = 2, `14` = 3)),
                control = gnlsControl(sigma = 1.8))

> logLik(mod1fix)
'log Lik.' -265.1203 (df=2)

But is there a general way to evaluate the likelihood at specified mean parameters?

0

There are 0 answers