Predict method for Cusp Model Fits

Share:

Description

Predicted values based on a cusp model object.

Usage

1
2
3
4
5
## 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 "cusp"

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 predict.lm. Not yet used.

interval

See predict.lm. Not yet used.

level

See predict.lm. Not yet used.

type

See predict.lm. Not yet used.

terms

See predict.lm. Not yet used.

na.action

See predict.lm. Not yet used.

pred.var

See predict.lm. Not yet used.

weights

See predict.lm. Not yet used.

method

Type of prediction convention to use. Can be abbreviated. (expected should currently not be trusted).

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*) = α + β 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*) = α 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;α, β)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

cusp-package, predict.lm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)