View source: R/data_preparation.R
feature_standardization | R Documentation |
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.
feature_standardization(
df,
timestamp_col,
entity_col,
time_effects = FALSE,
scale = TRUE
)
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 |
A dataframe with standardized features
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.