profile.glmmTMB {glmmTMB} | R Documentation |
Compute likelihood profiles for a fitted model
Description
Compute likelihood profiles for a fitted model
Usage
## S3 method for class 'glmmTMB'
profile(
fitted,
parm = NULL,
level_max = 0.99,
npts = 8,
stepfac = 1/4,
stderr = NULL,
trace = FALSE,
parallel = c("no", "multicore", "snow"),
ncpus = getOption("profile.ncpus", 1L),
cl = NULL,
...
)
## S3 method for class 'profile.glmmTMB'
confint(object, parm = NULL, level = 0.95, ...)
Arguments
fitted |
a fitted |
parm |
which parameters to profile, specified
|
level_max |
maximum confidence interval target for profile |
npts |
target number of points in (each half of) the profile (approximate) |
stepfac |
initial step factor (fraction of estimated standard deviation) |
stderr |
standard errors to use as a scaling factor when picking step
sizes to compute the profile; by default (if |
trace |
print tracing information? If |
parallel |
method (if any) for parallel computation |
ncpus |
number of CPUs/cores to use for parallel computation |
cl |
cluster to use for parallel computation |
... |
additional arguments passed to |
object |
a fitted profile ( |
level |
confidence level |
Details
Fits natural splines separately to the points from each half of the profile for each specified parameter (i.e., values above and below the MLE), then finds the inverse functions to estimate the endpoints of the confidence interval
Value
An object of class profile.glmmTMB
, which is also a
data frame, with columns .par
(parameter being profiled),
.focal
(value of focal parameter), value (negative log-likelihood).
Examples
## Not run:
m1 <- glmmTMB(count~ mined + (1|site),
zi=~mined, family=poisson, data=Salamanders)
salamander_prof1 <- profile(m1, parallel="multicore",
ncpus=2, trace=1)
## testing
salamander_prof1 <- profile(m1, trace=1,parm=1)
salamander_prof1M <- profile(m1, trace=1,parm=1, npts = 4)
salamander_prof2 <- profile(m1, parm="theta_")
## End(Not run)
salamander_prof1 <- readRDS(system.file("example_files","salamander_prof1.rds",package="glmmTMB"))
if (require("ggplot2")) {
ggplot(salamander_prof1,aes(.focal,sqrt(value))) +
geom_point() + geom_line()+
facet_wrap(~.par,scale="free_x")+
geom_hline(yintercept=1.96,linetype=2)
}
salamander_prof1 <- readRDS(system.file("example_files","salamander_prof1.rds",package="glmmTMB"))
confint(salamander_prof1)
confint(salamander_prof1,level=0.99)