| predict.cusp {cusp} | R Documentation |
Predict method for Cusp Model Fits
Description
Predicted values based on a cusp model object.
Usage
## S3 method for class 'cusp'
predict(object, newdata, se.fit = FALSE, interval =
c("none", "confidence", "prediction"), level = 0.95, type = c("response", "terms"),
terms = NULL, na.action = na.pass, pred.var = res.var/weights, weights = 1,
method = c("delay", "maxwell", "expected"), keep.linear.predictors = FALSE, ...)
Arguments
object |
Object of class " |
newdata |
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. |
se.fit |
See |
interval |
See |
level |
See |
type |
See |
terms |
See |
na.action |
See |
pred.var |
See |
weights |
See |
method |
Type of prediction convention to use. Can be abbreviated. ( |
keep.linear.predictors |
Logical. Should the linear predictors (alpha, beta, and y) be returned? |
... |
further arguments passed to or from other methods. |
Details
predict.cusp produces predicted values, obtained by evaluating the regression functions from the
cusp object in the frame newdata using predict.lm. This results in linear
predictors for the cusp control variables alpha, and beta, and, if method = "delay",
for the behavioral cusp variable y. These are then used to compute predicted values: If
method = "delay" these are the points y* on the cusp surface defined by
V'(y*) = \alpha + \beta y* - y*^3 = 0
that are closest to y. If method = "maxwell" they are
the points on the cusp surface corresponding to the minimum of the associated potential function
V(y*) = \alpha y* + 0.5 y*^2 - 0.25 y*^4.
Value
A vector of predictions. If keep.linear.predictors the return value has a "data" attribute
which links to newdata augmented with the linear predictors alpha, beta, and, if
method = "delay", y. If method = "expected", the expected value from the equilibrium
distribution of the stochastic process
dY_t = V'(Y_t;\alpha, \beta)dt + dW_t,
where W_t is
a Wiener proces (aka Brownian motion) is returned. (This distribution is implemented in
dcusp.)
Note
Currently method = "expected" should not be trusted.
Author(s)
Raoul Grasman
References
See cusp-package.
See Also
Examples
set.seed(123)
# example with regressors
x1 = runif(150)
x2 = runif(150)
z = Vectorize(rcusp)(1, 4*x1-2, 4*x2-1)
data <- data.frame(x1, x2, z)
fit <- cusp(y ~ z, alpha ~ x1+x2, beta ~ x1+x2, data)
newdata = data.frame(x1 = runif(10), x2 = runif(10), z = 0)
predict(fit, newdata)