Computes univariate likelihood profiles of fixed effect coefficients, random effect covariance parameters, and linear combinations thereof, including population fitted values.
# S3 method for egf
profile(fitted, level = 0.95,
A = seq_along(par), grid = 12L,
parallel = egf_parallel(), trace = FALSE,
top = egf_top(fitted), subset = NULL, select = NULL, ...)# S3 method for profile.egf
confint(object, parm = seq_along(object), level = attr(object, "level"),
class = FALSE, ...)
# S3 method for profile.egf
plot(x, parm = seq_along(x), level = attr(x, "level"),
type = c("z", "abs(z)", "z^2"), ...)
A list of length nrow(A)
inheriting from classes
profile.egf
and profile
. Each element is a data frame
specifying a profile, with two variables:
a numeric vector containing profile \(z\)-statistics. The profile \(z\)-statistic is the appropriately signed square root of the change in deviance under the restricted model.
a numeric matrix with one column containing values of the linear
combination specified by A[i, ]
.
The confidence level level
is preserved as an attribute.
an egf
object.
a number in the interval \((0,1)\) indicating a confidence level.
Profiles are computed up to a change in deviance equal to
qchisq(level, df = 1)
.
a numeric matrix with 1+p
columns,
where p = length(coef(fitted))
,
in which case each row specifies a linear combination of the elements
of c(1, coef(fitted))
to be profiled;
or a valid index vector for coef(fitted)
,
in which case the indexed elements are profiled;
or NULL
,
in which case population fitted values are profiled.
a positive integer. Step sizes chosen adaptively by
tmbprofile
will generate approximately this many
points on each side of a profile's minimum point.
an egf_parallel
object defining options for R level
parallelization.
a logical. If TRUE
, then basic tracing messages indicating
progress are printed. These may be mixed with optimizer output
depending on fitted[["control"]][["trace"]]
.
a subset of egf_top(fitted)
naming top level
nonlinear model parameters for which profiles on population
fitted values should be profiled.
index vectors for the rows and columns of
model.frame(fitted, "combined")
or language objects
evaluating to such vectors.
subset
indicates fitting windows for which profiles
should be computed; the default indicates all.
select
indicates variables that should be appended to
the result; the default indicates none.
Evaluation of language objects follows the implementation of
subset.data.frame
.
additional arguments passed from or to other methods.
a profile.egf
object.
a valid index vector for object
or x
indicating a subset
of the profiles.
a logical. If TRUE
and if object
was created by
profile(A = NULL)
,
then the value of the method call is a confint.egf
object, not a matrix.
a character string indicating which of \(z\), \(|z|\), and \(z^{2}\) is plotted.
Computation of likelihood profiles is typically expensive, requiring
estimation of many restricted models.
It is parallelized at the C++ level when there is OpenMP
support and fitted[["control"]][["omp_num_threads"]]
is set
to an integer greater than 1. When there is no OpenMP support, it
can still be parallelized at the R level with appropriate setting
of argument parallel
.
# \donttest{
example("egf", package = "epigrowthfit")
zz <- profile(m1, A = NULL,
top = "log(r)", subset = quote(country == "A" & wave == 1))
str(zz)
confint(zz, class = TRUE)
pty <- c("z", "abs(z)", "z^2")
bty <- c("l", "u", "u")
for (i in 1:3)
plot(zz, type = pty[i], bty = bty[i], las = 1)
# }
Run the code above in your browser using DataLab