View source: R/data_preparation.R
data_prep | 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. Additionally, it allows introduction of cross sectional and time fixed effects through demeaning.
data_prep(
df,
timestamp_col,
entity_col,
standardize = TRUE,
entity_effects = FALSE,
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) |
standardize |
Whether to standardize the data (by mean subtraction) |
entity_effects |
Whether to introduce time cross-section effects (by time demeaning) |
time_effects |
Whether to introduce time fixed effects (by cross-sectional demeaning) |
scale |
Whether to divide by the standard deviation |
A dataframe with standardized variables or/and prepared for fixed effects estimation
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)
)
data_prep(df, year, country, entity_effects = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.