feature_standardization: Perform feature standarization

View source: R/data_preparation.R

feature_standardizationR Documentation

Perform feature standarization

Description

This function performs feature standarization (also known as z-score normalization), i.e. the features are centered around the mean and scaled with standard deviation.

Usage

feature_standardization(
  df,
  timestamp_col,
  entity_col,
  time_effects = FALSE,
  scale = TRUE
)

Arguments

df

Dataframe with data that should be prepared for LIML estimation

timestamp_col

Column with timestamps (e.g. years)

entity_col

Column with entities (e.g. countries)

time_effects

Whether to introduce time fixed effects (by cross-sectional demeaning)

scale

Whether to divide by the standard deviation TRUE or not FALSE. Default is TRUE.

Value

A dataframe with standardized features

Examples

df <- data.frame(
  year = c(2000, 2001, 2002, 2003, 2004),
  country = c("A", "A", "B", "B", "C"),
  gdp = c(1, 2, 3, 4, 5),
  ish = c(2, 3, 4, 5, 6),
  sed = c(3, 4, 5, 6, 7)
)

feature_standardization(df, year, country)


bdsm documentation built on April 4, 2025, 1:06 a.m.