Wrapper to get the residuals of a fitted model
1 2 3 4
a fitted model
additional parameters to be passed on, usually to the residual function of the respective model class
The purpose of this wrapper is to standardize extract the model residuals. Similar to some other functions, a key question is whether to calculate those conditional or unconditional on the fitted REs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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[]) getRefit(fittedModel, getObservedResponse(fittedModel))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.