predict.optim_fit {OptimModel}R Documentation

Predicted values for optim.fit objects

Description

Provides predicted values, standard errors, confidence intervals and prediction intervals for optim_fit objects.

Usage

 
    ## S3 method for class 'optim_fit'
predict(object, x, se.fit=FALSE, 
    interval=c("none", "confidence", "prediction"), K = 1, level = 0.95,...)

Arguments

object

An object resulting from optim_fit.

x

If supplied, a vector, data.frame, or matrix of Explanatory variables.

se.fit

Logical. Should standard errors be returned? Requires that 'x' is supplied.

interval

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.

K

Only used for prediction interval. Number of observations in the mean for the prediction interval.

level

Confidence/prediction interval level.

...

mop up additional arguments.

Value

Returns a vector (if interval='none'). Otherwise returns a data.frame with possible columns 'x', 'y.hat', 'se.fit', 'lower', and 'upper'.

Author(s)

Steven Novick

See Also

optim_fit

Examples

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")

[Package OptimModel version 2.0-1 Index]