Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

profile.glmmTMB

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

Generalized Linear Mixed Models using Template Model Builder

v1.0.2.1
AGPL-3
Authors
Arni Magnusson [aut] (<https://orcid.org/0000-0003-2769-6741>), Hans Skaug [aut], Anders Nielsen [aut] (<https://orcid.org/0000-0001-9683-9262>), Casper Berg [aut] (<https://orcid.org/0000-0002-3812-5269>), Kasper Kristensen [aut], Martin Maechler [aut] (<https://orcid.org/0000-0002-8685-9910>), Koen van Bentham [aut], Ben Bolker [aut] (<https://orcid.org/0000-0002-2127-0443>), Nafis Sadat [ctb] (<https://orcid.org/0000-0001-5715-616X>), Daniel Lüdecke [ctb] (<https://orcid.org/0000-0002-8895-3206>), Russ Lenth [ctb], Joseph O'Brien [ctb] (<https://orcid.org/0000-0001-9851-5077>), Mollie Brooks [aut, cre] (<https://orcid.org/0000-0001-6963-8326>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.