Sometimes PC model can generate negative values for some features. E.g. South Africa where GINI is much too high. Here, the function adjusts negative predicted features.

adjust_negative_predicted_features(
  df,
  min_lowest_feature_val = 0.006,
  grouping_variables = c("country", "year")
)

Arguments

df

dataframe with decile data

min_lowest_feature_val

Lowest possible value for lowest feature (e.g. d1).

grouping_variables

variables to group by