Learn R Programming

DHARMa (version 0.3.3.0)

getObservedResponse: Get model response

Description

Extract the response of a fitted model

Usage

getObservedResponse(object, ...)

# S3 method for default getObservedResponse(object, ...)

# S3 method for HLfit getObservedResponse(object, ...)

Arguments

object

a fitted model

...

additional parameters

Details

The purpose of this function is to savely extract the response (dependent variable) of the fitted model classes

See Also

getRefit, getSimulations, getFixedEffects, getFitted

Examples

Run this code
# NOT RUN {
testData = createData(sampleSize = 400, family = gaussian())

fittedModel <- lm(observedResponse ~ Environment1 , data = testData)

# response that was used to fit the model
getObservedResponse(fittedModel)

# predictions of the model for these points
getFitted(fittedModel)

# extract simulations from the model as matrix
getSimulations(fittedModel, nsim = 2)

# extract simulations from the model for refit (often requires different structure)
x = getSimulations(fittedModel, nsim = 2, type = "refit")

getRefit(fittedModel, x[[1]])

getRefit(fittedModel, getObservedResponse(fittedModel))
# }

Run the code above in your browser using DataLab