Function to calculate coefficients from raw data

compute_components_data(
  df,
  center_and_scaler_data = pc_center_sd,
  pc_loadings = pc_loading_matrix,
  category_col = "Category",
  value_col = "value",
  SCALE = TRUE,
  number_of_features = 10,
  grouping_variables = c("country", "year")
)

Arguments

df

dataframe with decile data

center_and_scaler_data

The centers and SD for the data. This is pre-saved. But can be generated using `get_sd_center()` above.

category_col

column with categorical definitions for deciles

value_col

Name of values to be output.

SCALE

Boolean which defines if the PC analysis is to be scaled or not.

grouping_variables

variables to group by