scale_vars {minMSE}R Documentation

Covariate Vectors Scaling

Description

Scales the data such that the empty fiels (NA) are the mean of the column and all variables are scaled to have variance 1. In case a variable has cero variance, the variable internally is treated as if it was 0, that way it is not taken into account for treatment assignment.

Usage

scale_vars(data)

Arguments

data

a dataframe containing the covariate vectors for each attribute.

Value

Returns a dataframe where the empty fields are filled with the mean of the column, and for all variables the variance is 1.

Author(s)

Sebastian Schneider sschneider@coll.mpg.de; sebastian@sebastianschneider.eu, Giulia Baldini giulia.baldini@uni-bonn.de

Examples

input <- data.frame(c(10, 20, 30, 40, 130, 40, 120, 5, 10, 80),
                    c(2, 6, 2, 8, 1, 10, 9, 8, 7, 5),
                    c(1, 0, 2, 1, 0, 1, 0, 2, 1, 0))
colnames(input) <- c("IQ", "grade_maths", "both_parents")

scale_vars(input)

[Package minMSE version 0.5.1 Index]