profile.glmmTMB: Compute likelihood profiles for a fitted model

View source: R/profile.R

profile.glmmTMBR 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 glmmTMB object

parm

which parameters to profile, specified

  • by index (position)

  • by name (matching the row/column names of vcov(object,full=TRUE))

  • as "theta_" (random-effects variance-covariance parameters) or "beta_" (conditional and zero-inflation parameters)

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 stderr is NULL, or NA for a particular element), uses the estimated (Wald) standard errors of the parameters

trace

print tracing information? If trace=FALSE or 0, no tracing; if trace=1, print names of parameters currently being profiled; if trace>1, turn on tracing for the underlying tmbprofile function

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 tmbprofile

object

a fitted profile (profile.glmmTMB) object

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)

glmmTMB documentation built on Oct. 7, 2023, 5:07 p.m.