Learn R Programming

onls (version 0.3)

confint.onls: Confidence intervals for 'onls' model parameters

Description

Computes confidence intervals for the free parameters of an onls model, from the profile of the orthogonal-distance objective (default), from the standard errors (Wald), or by a nonparametric bootstrap.

Usage

# S3 method for onls
confint(object, parm, level = 0.95, method = c("profile", "wald", "boot"),
        k = 200, max_tries = 10 * k, verbose = FALSE, ...)

Value

A matrix with one row per parameter and columns giving the lower and upper confidence limits. For method = "boot", the attribute "n_boot" holds the number of successful bootstrap fits.

Arguments

object

an object returned from onls.

parm

parameters for which intervals are computed, as names or indices; default all free (non-fixed) parameters. Fixed parameters are dropped with a warning.

level

the confidence level required.

method

"profile" (default), "wald" or "boot"; see 'Details'.

k

for method = "boot": the number of successful bootstrap fits.

max_tries

for method = "boot": the maximum number of refits attempted; if fewer than k succeed, a warning gives the count.

verbose

for method = "boot": logical, print a progress line.

...

for method = "profile": further arguments passed to profile.onls, such as maxpts.

Author

Andrej-Nikolai Spiess

Details

The profile and Wald intervals use the quantile \(q\) of the normal distribution when the variances are known (known_sigma = TRUE in onls) and of the \(t\) distribution with df_resid degrees of freedom otherwise.

"profile". Each parameter is held fixed on a grid around its estimate while all other free parameters and all foot points are re-optimized (profile.onls). With \(S\) the minimized orthogonal objective, the profile statistic is \(\tau = \mathrm{sign}(\theta_j - \hat\theta_j)\sqrt{(S(\theta_j) - \hat S)/s^2}\), with \(s^2 = \hat S/\mathrm{df}\) (estimated variances) or \(s^2 = 1\) (known variances). The limits are where \(\tau = \pm q\), found by interpolating the profile. Profile intervals follow the shape of the objective and can be asymmetric. Only the part of the profile on which \(\tau\) increases steadily away from the estimate is used. A limit that the profile does not reach is returned as NA, with a warning that says why: most often the profile flattens out because the data do not bound the parameter on that side, or a lower/upper bound lies inside the interval.

"wald". \(\hat\theta_j \pm q \cdot SE_j\), with the standard errors of vcov. Instant and accurate for well-determined parameters, but symmetric by construction, and too narrow when the objective is strongly asymmetric in a parameter.

"boot". Nonparametric case bootstrap. In each replicate, the rows of the data used in the fit (after subset and na.action) are sampled with replacement, together with their row-aligned weights, sigma_x and sigma_y, and the model is refitted with all other settings of the original call, starting from the original estimates. Fits that do not converge are discarded; if all points of the original fit were orthogonal, refits with non-orthogonal points are discarded as well. The limits are the empirical quantiles of the k successful fits. At most max_tries refits are attempted. Case resampling is unreliable for very small \(n\).

See Also

profile.onls, vcov.

Examples

Run this code
set.seed(123)
DNase1 <- subset(DNase, Run == 1)
DNase1$density <- sapply(DNase1$density, function(x) rnorm(1, x, 0.1 * x))
mod1 <- onls(density ~ Asym/(1 + exp((xmid - log(conc))/scal)), 
             data = DNase1, start = list(Asym = 3, xmid = 0, scal = 1))
confint(mod1)                      # profile
confint(mod1, method = "wald")     # symmetric, too narrow for Asym
# \donttest{
confint(mod1, method = "boot", k = 50) # just time optimization, consider k >= 200.
# }

Run the code above in your browser using DataLab