Confidence intervals
This computes confidence intervals for given parameter(s), based either on parametric bootstrap or, for fixed-effect parameters, on the p_v
-based approximation of the profile likelihood ratio for this parameter. The profiling is over all other fitted parameters, including fixed effects, as well as variances of random effects and spatial correlations if these were fitted. The bootstrap is performed if the parm
argument is a function or a quoted expression or if the boot_args
argument is a list. The profile confidence interval is computed if neither of these conditions is true; in that case parm
must be the name(s) of some fixed-effect coefficient.
## S3 method for class 'HLfit' confint(object, parm, level=0.95, verbose=TRUE, boot_args=NULL, format="default", ...)
object |
An object of class |
parm |
character vector, integer vector, or function, or a quoted expression. If character, the name(s) of parameter(s) to be fitted; if integer, their position in the |
level |
The coverage of the interval. |
verbose |
whether to print the interval or not. As the function returns its more extensive results invisibly, this printing is the only visible output. |
boot_args |
NULL or a list of arguments passed to functions |
format |
Only effective non-default value is |
... |
Additional arguments (maybe not used, but conforming to the generic definition of |
The format of the value varies, but in all cases distinguished below, one or more tables are included, as a table
attribute, in the format of the stats::confint
result, to facilitate consistent extraction of results. By default confint
returns invisibly the full values described below, but if format="stats"
, only the table
attribute is returned.
If a profile CI has been computed for a single parameter, a list is returned including the confidence interval
as shown by verbose=TRUE
, and the fits lowerfit
and upperfit
giving the profile fits at the confidence bounds. This list bears the table
attribute.
If a profile CI has been computed for several parameters, a structured list, named according to the parameter names, of such single-parameter results is returned, and a single table
attribute for all parameters is attached to the upper level of the list.
If a bootstrap was performed, for a single parameter the result of the boot.ci
call is returned, to which a table
attribute is added. This table
is now a list of tables for the different bootstrap CI types (default being normal
, percent
, and basic
), each such table in the format of the stats::confint
results. For several parameters, a named list of boot.ci
results is returned, its names being the parameter names, and the table
attribute is attached to the upper level of the list.
The boot.ci
return value for each parameter includes the call to boot.ci
. This call is typically shown including a long t
vector, which makes a bulky display. spaMM hacks the printing to abbreviate long t
s.
data("wafers") wfit <- HLfit(y ~X1+(1|batch),family=Gamma(log),data=wafers,method="ML") confint(wfit,"X1") # profile CI if (spaMM.getOption("example_maxtime")>30) { # bootstrap CI induced by 'boot_args': confint(wfit,names(fixef(wfit)), boot_args=list(nsim=99, seed=123)) # bootstrap CI induced by 'parm' being a function: confint(wfit,parm=function(v) fixef(v), boot_args=list(nb_cores=10, nsim=199, seed=123)) # Same effect if 'parm' is a quoted expression in terms of 'hlfit': confint(wfit,parm=quote(fixef(hlfit)), boot_args=list(nb_cores=10, nsim=199, seed=123)) # CI for the variance of the random effect: ( ci <- confint(wfit,parm=function(fit){VarCorr(fit)[1,"Variance"]}, boot_args=list(nb_cores=10, nsim=199, seed=123)) ) # The distribution of bootstrap replicates: plot(ecdf(ci$call$t)) # We may be far from ideal condition for accuracy of bootstrap intervals; # for variances, a log transformation may sometimes help, but not here. }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.