Learn R Programming

bbmle (version 0.8.9)

as.data.frame.profile.mle2: convert profile to data frame

Description

converts a profile of a fitted mle2 object to a data frame

Usage

## S3 method for class 'profile.mle2':
as.data.frame(x, row.names=NULL,
optional=FALSE, \dots)

Arguments

x
a profile object
row.names
row names (unused)
optional
unused
...
unused

Value

  • a data frame with columns
  • paramname of parameter being profiled
  • zsigned square root of the deviance difference from the minimum
  • parameter valuesnamed par.vals.parname
  • focalvalue of focal parameter: redundant, but included for plotting convenience

Examples

Run this code
## use as.data.frame and lattice to plot profiles
  x <- 0:10
  y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
  library(bbmle)
  LL <- function(ymax=15, xhalf=6)
  -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))
  ## uses default parameters of LL
  fit1 <- mle2(LL)
  p1 <- profile(fit1)
  d1 = as.data.frame(p1)
  library(lattice)
  xyplot(abs(z)~focal|param,data=d1,
    subset=abs(z)<3,
    type="b",
    xlab="",
    ylab=expression(paste(abs(z),
    "(square root of ",Delta,"deviance)")),
    scale=list(x=list(relation="free")))

Run the code above in your browser using DataLab