Provides predicted values, standard errors, confidence intervals and prediction intervals for optim_fit
objects.
# S3 method for optim_fit
predict(object, x, se.fit=FALSE,
interval=c("none", "confidence", "prediction"), K = 1, level = 0.95,...)
Returns a vector (if interval='none'). Otherwise returns a data.frame with possible columns 'x', 'y.hat', 'se.fit', 'lower', and 'upper'.
An object resulting from optim_fit
.
If supplied, a vector, data.frame, or matrix of Explanatory variables.
Logical. Should standard errors be returned? Requires that 'x' is supplied.
If equal to 'confidence', returns a 100*level% confidence interval for the mean response. If equal to 'prediction', returns a 100*level% prediction interval for the mean of the next K observations. Requires that 'x' is supplied.
Only used for prediction interval. Number of observations in the mean for the prediction interval.
Confidence/prediction interval level.
mop up additional arguments.
Steven Novick
optim_fit
set.seed(123L)
x = rep( c(0, 2^(-4:4)), each=4 )
theta = c(0, 100, log(.5), 2)
y1 = hill_model(theta, x) + rnorm( length(x), sd=2 )
fit1=optim_fit(theta, hill_model, x=x, y=y1)
fitted(fit1)
predict(fit1)
predict(fit1, x=x)
predict(fit1, x=seq(0, 1, by=.1), se.fit=TRUE)
predict(fit1, x=seq(0, 1, by=.1), interval="conf")
predict(fit1, x=seq(0, 1, by=.1), interval="pred")
Run the code above in your browser using DataLab