Learn R Programming

mpt (version 0.3-0)

residuals.mpt: Residuals for MPT Models

Description

Computes deviance and Pearson residuals for mpt objects.

Usage

## S3 method for class 'mpt':
residuals(object, type = c("deviance", "pearson"), ...)

Arguments

object
an object of class mpt, typically the result of a call to mpt.
type
the type of residuals which should be returned; the alternatives are: "deviance" (default) and "pearson".
...
further arguments passed to or from other methods. None are used in this method.

Value

  • A named vector of residuals having as many elements as response categories. The names are given by the treeid.

Details

See residuals.glm for details.

See Also

mpt, residuals.glm, plot.mpt.

Examples

Run this code
data(retroact)                      # retroactive inhibition data

mpt1 <- mpt(freq ~ list(            # fit storage-retrieval model
  c*r,
  (1 - c)*u^2,
  2*(1 - c)*u*(1- u),
  c*(1 - r) + (1 - c)*(1 - u)^2,
  u,
  1 - u
), retroact[retroact$lists == 0,])

sum( resid(mpt1)^2 )                # likelihood ratio G2
sum( resid(mpt1, "pearson")^2 )     # Pearson X2

Run the code above in your browser using DataLab