Description Usage Arguments Value References Examples
The function invest
computes the inverse estimate and a condfidence
interval for the unknown predictor value that corresponds to an observed
value of the response (or vector thereof) or specified value of the mean
response. See the references listed below for more details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  invest(object, ...)
## S3 method for class 'lm'
invest(object, y0, interval = c("inversion", "Wald",
"percentile", "none"), level = 0.95, mean.response = FALSE, x0.name,
newdata, data, boot.type = c("parametric", "nonparametric"), nsim = 999,
seed = NULL, progress = FALSE, lower, upper, extendInt = "no",
tol = .Machine$double.eps^0.25, maxiter = 1000, adjust = c("none",
"Bonferroni"), k, ...)
## S3 method for class 'glm'
invest(object, y0, interval = c("inversion", "Wald",
"percentile", "none"), level = 0.95, lower, upper, x0.name, newdata, data,
tol = .Machine$double.eps^0.25, maxiter = 1000, ...)
## S3 method for class 'nls'
invest(object, y0, interval = c("inversion", "Wald",
"percentile", "none"), level = 0.95, mean.response = FALSE, data,
boot.type = c("parametric", "nonparametric"), nsim = 1, seed = NULL,
progress = FALSE, lower, upper, tol = .Machine$double.eps^0.25,
maxiter = 1000, adjust = c("none", "Bonferroni"), k, ...)
## S3 method for class 'lme'
invest(object, y0, interval = c("inversion", "Wald",
"percentile", "none"), level = 0.95, mean.response = FALSE, data, lower,
upper, q1, q2, tol = .Machine$double.eps^0.25, maxiter = 1000, ...)

object 
An object that inherits from class 
... 
Additional optional arguments. At present, no optional arguments are used. 
y0 
The value of the observed response(s) or specified value of the
mean response. For 
interval 
The type of interval required. 
level 
A numeric scalar between 0 and 1 giving the confidence level for the interval to be calculated. 
mean.response 
Logical indicating whether confidence intervals should
correspond to an individual response ( 
x0.name 
For multiple linear regression, a character string giving the the name of the predictor variable of interest. 
newdata 
For multiple linear regression, a 
data 
An optional data frame. This is required if 
boot.type 
Character string specifying the type of bootstrap to use
when 
nsim 
Positive integer specifying the number of bootstrap simulations; the bootstrap B (or R). 
seed 
Optional argument to 
progress 
Logical indicating whether to display a textbased progress bar during the bootstrap simulation. 
lower 
The lower endpoint of the interval to be searched. 
upper 
The upper endpoint of the interval to be searched. 
extendInt 
Character string specifying if the interval

tol 
The desired accuracy passed on to 
maxiter 
The maximum number of iterations passed on to 
adjust 
A logical value indicating if an adjustment should be made to the critical value used in calculating the confidence interval. This is useful for when the calibration curve is to be used multiple, say k, times. 
k 
The number times the calibration curve is to be used for computing
a confidence interval. Only needed when

q1 
Optional lower cutoff to be used in forming confidence intervals.
Only used when 
q2 
Optional upper cutoff to be used in forming confidence intervals.
Only used when 
invest
returns an object of class "invest"
or, if
interval = "percentile"
, of class
c("invest", "bootCal")
. The generic function plot
can be used to plot the output of the bootstrap simulation when
interval = "percentile"
.
An object of class "invest"
contains the following
components:
estimate
The estimate of x0.
lwr
The lower confidence limit for x0.
upr
The upper confidence limit for x0.
se
An estimate of the standard error (Wald and percentile
intervals only).
bias
The bootstrap estimate of bias (percentile interval
only).
bootreps
Vector of bootstrap replicates (percentile
interval only).
nsim
The number of bootstrap replicates (percentile
interval only).
interval
The method used for calculating lower
and
upper
(only used by print
method).
Greenwell, B. M., and Schubert Kabban, C. M. (2014). investr: An R Package for Inverse Estimation. The R Journal, 6(1), 90–100. URL http://journal.rproject.org/archive/20141/greenwellkabban.pdf.
Graybill, F. A., and Iyer, H. K. (1994). Regression analysis: Concepts and Applications. Duxbury Press.
Huet, S., Bouvier, A., Poursat, MA., and Jolivet, E. (2004) Statistical Tools for Nonlinear Regression: A Practical Guide with SPLUS and R Examples. Springer.
Norman, D. R., and Smith H. (2014). Applied Regression Analysis. John Wiley & Sons.
Oman, Samuel D. (1998). Calibration with Random Slopes. Biometrics 85(2): 439–449. doi:10.1093/biomet/85.2.439.
Seber, G. A. F., and Wild, C. J. (1989) Nonlinear regression. Wiley.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  #
# Dobson's beetle data (generalized linear model)
#
# Complementary loglog model
mod < glm(cbind(y, ny) ~ ldose, data = beetle,
family = binomial(link = "cloglog"))
plotFit(mod, pch = 19, cex = 1.2, lwd = 2,
xlab = "Log dose of carbon disulphide",
interval = "confidence", shade = TRUE,
col.conf = "lightskyblue")
# Approximate 95% confidence intervals and standard error for LD50
invest(mod, y0 = 0.5)
invest(mod, y0 = 0.5, interval = "Wald")
#
# Nasturtium example (nonlinear leastsquares with replication)
#
# Loglogistic model
mod < nls(weight ~ theta1/(1 + exp(theta2 + theta3 * log(conc))),
start = list(theta1 = 1000, theta2 = 1, theta3 = 1),
data = nasturtium)
plotFit(mod, lwd.fit = 2)
# Compute approximate 95% calibration intervals
invest(mod, y0 = c(309, 296, 419), interval = "inversion")
invest(mod, y0 = c(309, 296, 419), interval = "Wald")
# Bootstrap calibration intervals. In general, nsim should be as large as
# reasonably possible (say, nsim = 9999).
boo < invest(mod, y0 = c(309, 296, 419), interval = "percentile",
nsim = 999, seed = 101)
boo # print bootstrap summary
plot(boo) # plot results

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.