defaultMixedModel: This function imputes missing values with a linear mixed...

Description Usage Arguments Details Value

View source: R/defaultMixedModel.R


The default functionality of this model is to fit a linear mixed model to the data. time and intercept are assumed to be fixed effects, and the random effects are specified by the byKey parameter of imputationParameters. So, for example, byKey may reference the variable containing country data. In that case, a model is fit which assumes a linear relationship between production (or whatever dependent variable the user has specified) and time. However, the intercept and slope of this fit varies from country to country, and so country is considered a random effect.


defaultMixedModel(data, df = 1, weights = NULL, modelFormula = NULL,



The data.table object containing the data.


The number of degrees of freedom for the spline.


The weights for the observations.


Formula specifying how the dependent variable (value) depends on the other columns of data. Should be a valid mixed model formula, as it will be passed to lmer (R's mixed model function).


A list of the parameters for the imputation algorithms. See defaultImputationParameters() for a starting point.


Moreover, the model fit is not a simple linear regression, but rather a spline regression (using the bs function from the splines package). The fit of this model will therefore depend on the number of degrees of freedom of this spline model (and, if the degrees of freedom is 1, then the simple linear regression model is used).


Returns a vector of the estimated/imputed values. If a value existed in the original data, then an NA is returned in that location.

SWS-Methodology/faoswsImputation documentation built on April 7, 2018, 10:12 p.m.