newresponse: Extract Observed Responses from New Data

View source: R/newresponse.R

newresponseR Documentation

Extract Observed Responses from New Data

Description

Generic function and methods for computing (randomized) quantile residuals.

Usage

newresponse(object, ...)

## Default S3 method:
newresponse(object, newdata, na.action = na.pass, ...)

## S3 method for class 'glm'
newresponse(object, newdata, na.action = na.pass, ...)

Arguments

object

a fitted model object. For the default method this needs to needs to be formula-based so that model.frame can be used to extract the response from the original data the model was fitted to or terms can be used to set up the response on newdata.

...

further parameters passed to methods.

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used.

na.action

function determining what should be done with missing values in newdata. The default is to employ NA.

Details

This is a convenience function to accompany procast, e.g., for computing predicted probabilities at the observed responses (also known as the probability integral transform, PIT).

Value

A vector of new responses.

See Also

terms, model.frame

Examples


## linear regression models (homoscedastic Gaussian response)
m <- lm(dist ~ speed, data = cars)
newresponse(m)
newresponse(m, newdata = cars[1:3, ])


topmodels documentation built on Sept. 10, 2022, 3 p.m.