profile.ctsmTMB.fit | R Documentation |
#' Performs full multi-dimensional profile likelihood calculations
## S3 method for class 'ctsmTMB.fit'
profile(
fitted,
parlist,
grid.size = rep(10, length(parlist)),
grid.qnt = rep(3, length(parlist)),
hessian = FALSE,
silent = FALSE,
control = list(trace = 0, iter.max = 1000, eval.max = 1000),
...
)
fitted |
a ctmsTMB fit object |
parlist |
a named-list of parameters to profile over. The user can either supply grid-values in the list or leave it empty. If the any one list is empty then grid-values will be calculated using the estimated parameter mean value and standard deviation. |
grid.size |
a vector of |
grid.qnt |
a vector of |
hessian |
a boolean indicating whether to use the hessian or not during the profile optimization. |
silent |
boolean whether or not to mute current iteration number
the |
control |
a list of optimization output controls (see nlminb) |
... |
various arguments (not in use) |
The implementation was modified from that of https://github.com/kaskr/adcomp/blob/master/TMB/R/tmbprofile.R
library(ctsmTMB)
model <- ctsmTMB$new()
# create model
model$addSystem(dx ~ theta * (mu+u-x) * dt + sigma_x*dw)
model$addObs(y ~ x)
model$setVariance(y ~ sigma_y^2)
model$addInput(u)
model$setParameter(
theta = c(initial = 1, lower=1e-5, upper=50),
mu = c(initial=1.5, lower=0, upper=5),
sigma_x = c(initial=1, lower=1e-10, upper=30),
sigma_y = 1e-2
)
model$setInitialState(list(1,1e-1))
# fit model to data
fit <- model$estimate(Ornstein)
# calculate profile likelihood
out <- profile(fit,parlist=list(theta=NULL))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.