View source: R/lm_imputation.R
lm_imputation | R Documentation |
The lm_imputation function aims to replace missing values (NA) in a dataset with values estimated using a linear regression model. This technique allows the existing relationships between variables in the dataset to be used to accurately estimate missing values
lm_imputation(data, to_impute, regressors)
data |
dataframe with rows = observations and columns = quantitative variables |
to_impute |
string , name of the variables whre there are NANs to impute |
regressors |
vector of string with names of the variables to use to apply linear regression imputation |
It returns a dataframe with imputed values
OECD/European Union/EC-JRC (2008), Handbook on Constructing Composite Indicators: Methodology and User Guide, OECD Publishing, Paris, <https://doi.org/10.1787/9789264043466-en>
data("airquality")
regressors<-colnames(airquality[,c(3,4)])
lm_imputation(data =airquality,"Ozone",regressors = regressors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.