lm_imputation {Indicator}R Documentation

Function to apply nan inputation with linear regression

Description

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

Usage

lm_imputation(data, to_impute, regressors)

Arguments

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

Value

It returns a dataframe with imputed values

References

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>

Examples


data("airquality")
regressors<-colnames(airquality[,c(3,4)])
lm_imputation(data =airquality,"Ozone",regressors = regressors)


[Package Indicator version 0.1.2 Index]