Learn R Programming

ndl (version 0.2.18)

predict.ndlClassify: Predict method for ndlClassify objects

Description

Obtains predictions on the basis of a fitted "ndlClassify" object on data already incorporated in the object or on new data with the same predictors as the originally fitted model object.

Usage

# S3 method for ndlClassify
predict(object, newdata=NULL, frequency=NA,
   type="choice", …)

Arguments

object

objects of class "ndlClassify", typically the result of a call to ndlClassify.

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted (i.e. set to NULL), the original data used to fit the object are used.

frequency

A numeric vector (or the name of a column in the (new) data frame newdata) with the frequencies of the exemplars. If absent, each exemplar is assigned a frequency equal to 1.

type

the type of prediction requested. The default option type="choice" produces the predicted individual discrete choices (i.e. Outcomes), given the predictor Cues selected for fitting the original object. The option type="acts" provides the sum activations for each Outcome given the Cue combinations in newdata (or in the original data in object, while the alternative type="probs" yields the distributions of predicted probabilities (based on the activations) over the Outcome responses.

further arguments passed to and from other functions.

Value

a vector predicted, or matrix of activations activations, or a matrix of predictions probabilities.

Details

If newdata is omitted the predictions are based on the data used for the fit.

References

Arppe, A. and Baayen, R. H. (in prep.) Statistical classification and principles of human learning.

See Also

ndlClassify, estimateActivations, acts2probs

Examples

Run this code
# NOT RUN {
data(think)
think.ndl <- ndlClassify(Lexeme ~ Agent + Patient, data=think[1:300,])
head(predict(think.ndl, type="choice"))
predict(think.ndl, newdata=think[301:320,], type="probs")
predict(think.ndl, newdata=think[301:320,], type="acts")

# }

Run the code above in your browser using DataLab