getRefit | R Documentation |
Wrapper to refit a fitted model
checks if the fitted model excluded NA values
getRefit(object, newresp, ...) ## Default S3 method: getRefit(object, newresp, ...) ## S3 method for class 'lm' getRefit(object, newresp, ...) ## S3 method for class 'glmmTMB' getRefit(object, newresp, ...) ## S3 method for class 'HLfit' getRefit(object, newresp, ...) ## S3 method for class 'MixMod' getRefit(object, newresp, ...)
object |
a fitted model |
newresp |
the new response that should be used to refit the model |
... |
additional parameters to be passed on to the refit or update class that is used to refit the model |
The purpose of this wrapper is to standardize the refit of a model. The behavior of this function depends on the supplied model. When available, it uses the refit method, otherwise it will use update. For glmmTMB: since version 1.0, glmmTMB has a refit function, but this didn't work, so I switched back to this implementation, which is a hack based on the update function.
Checks if the fitted model excluded NA values
Florian Hartig
getObservedResponse
, getSimulations
, getFixedEffects
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.