Description Usage Arguments Examples
Model an imputed dataset
1 2 3 4 5 6 7 8 9 | model_impute(object, model.fun, rhs, model.args, extractor, extractor.args)
## S4 method for signature 'ANY'
model_impute(object, model.fun, rhs, model.args, extractor,
extractor.args)
## S4 method for signature 'aggregatedImputed'
model_impute(object, model.fun, rhs, model.args,
extractor, extractor.args)
|
object |
the imputed dataset |
model.fun |
the function to apply on each imputation set |
rhs |
the right hand side of the model |
model.args |
an optional list of arguments to pass to the model function. |
extractor |
a function which return a |
extractor.args |
an optional list of arguments to pass to the extractor function. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | dataset <- generateData(n.year = 10, n.site = 50, n.run = 1)
dataset$Count[sample(nrow(dataset), 50)] <- NA
model <- lm(Count ~ Year + factor(Period) + factor(Site), data = dataset)
imputed <- impute(data = dataset, model = model)
aggr <- aggregate_impute(imputed, grouping = c("Year", "Period"), fun = sum)
extractor <- function(model){
summary(model)$coefficients[, c("Estimate", "Std. Error")]
}
model_impute(
object = aggr,
model.fun = lm,
rhs = "0 + factor(Year)",
extractor = extractor
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.