Returns predicted values for the expected response from a fitted "gsl_nls" object. Asymptotic confidence or prediction (tolerance) intervals at a given level can be evaluated by specifying the appropriate interval argument.
## S3 method for class 'gsl_nls'predict( object, newdata, scale =NULL, interval = c("none","confidence","prediction"), level =0.95,...)
Arguments
object: An object inheriting from class "gsl_nls".
newdata: A named list or data.frame in which to look for variables with which to predict. If newdata is missing, the predicted values at the original data points are returned.
scale: A numeric scalar or vector. If it is set, it is used as the residual standard deviation (or vector of residual standard deviations) in the computation of the standard errors, otherwise this information is extracted from the model fit.
interval: A character string indicating if confidence or prediction (tolerance) intervals at the specified level should be returned.
level: A numeric scalar between 0 and 1 giving the confidence level for the intervals (if any) to be calculated.
...: At present no optional arguments are used.
Returns
If interval = "none" (default), a vector of predictions for the mean response. Otherwise, a matrix with columns fit, lwr and upr. The first column (fit) contains predictions for the mean response. The other two columns contain lower (lwr) and upper (upr) confidence or prediction bounds at the specified level.
Examples
## dataset.seed(1)n <-25xy <- data.frame( x =(1:n)/ n, y =2.5* exp(-1.5*(1:n)/ n)+ rnorm(n, sd =0.1))## modelobj <- gsl_nls(fn = y ~ A * exp(-lam * x), data = xy, start = c(A =1, lam =1))predict(obj)predict(obj, newdata = data.frame(x =1:(2* n)/ n))predict(obj, interval ="confidence")predict(obj, interval ="prediction", level =0.99)