Generated by *https://fanwangecon.github.io/PrjOptiAlloc/articles/ffv_opt_solin_relow.html*, opti allocate and expected outcome. solin, linear solution. relow, relative to lowest

data(df_opt_dtgch_cbem4_rrlop)

Format

csv

References

“Early life height and weight production functions with endogenous energy and protein inputs”, September 2016, 65-81, Economics & Human Biology, 22, Esteban Puentes, Fan Wang, Jere R. Behrman, Flavio Cunha, John Hoddinott, John A. Maluccio, Linda S. Adair, Judith Borja and Reynaldo Martorell

Examples

data(df_opt_dtgch_cbem4_rrlop)
ar_opti_inpalc <- df_opt_dtgch_cbem4_rrlop[['opti_allocate']]
ar_opti_expout <- df_opt_dtgch_cbem4_rrlop[['opti_exp_outcome']]
ar_opti_inpalc_cv <- (ar_opti_inpalc - mean(ar_opti_inpalc))/sd(ar_opti_inpalc)
ar_opti_expout_cv <- (ar_opti_expout - mean(ar_opti_expout))/sd(ar_opti_expout)
# Print
head(df_opt_dtgch_cbem4_rrlop, 10)
#> # A tibble: 10 x 21
#>    indi.id     A alpha    beta rank_val rank_y_inter_idx lowest_rank_A
#>      <dbl> <dbl> <dbl>   <dbl>    <dbl>            <int>         <dbl>
#>  1      33  1.42 0.722 0.0261      2.03               15          1.12
#>  2      48  1.09 0.519 0.00298     1.97               14          1.12
#>  3       6  1.21 0.141 0.0346      1.96               13          1.12
#>  4      41  1.13 0.229 0.0121      1.93               12          1.12
#>  5      35  1.10 0.122 0.0202      1.90               11          1.12
#>  6      40  1.18 0.308 0.0171      1.89               10          1.12
#>  7      14  1.27 0.615 0.0368      1.80                9          1.12
#>  8      30  1.11 0.232 0.0268      1.76                8          1.12
#>  9      31  1.24 0.967 0.0240      1.75                7          1.12
#> 10      12  1.09 0.508 0.0117      1.74                6          1.12
#> # ... with 14 more variables: rela_slope_to_lowest <dbl>,
#> #   rela_intercept_to_lowest <dbl>, rela_x_intercept <dbl>,
#> #   rank_x_inter_idx <int>, rela_slope_to_lowest_cumsum <dbl>,
#> #   rela_intercept_to_lowest_cumsum <dbl>,
#> #   rela_slope_to_lowest_cumsum_invert <dbl>,
#> #   rela_intercept_to_lowest_cumsum_invert <dbl>,
#> #   opti_lowest_spline_knots <dbl>, tot_devi <dbl>, allocate_lowest <dbl>, ...
summary(df_opt_dtgch_cbem4_rrlop)
#>     indi.id            A             alpha             beta          
#>  Min.   : 1.00   Min.   :1.001   Min.   :0.1222   Min.   :0.0004062  
#>  1st Qu.:13.25   1st Qu.:1.226   1st Qu.:0.3442   1st Qu.:0.0100739  
#>  Median :25.50   Median :1.445   Median :0.5527   Median :0.0195919  
#>  Mean   :25.50   Mean   :1.477   Mean   :0.5681   Mean   :0.0200000  
#>  3rd Qu.:37.75   3rd Qu.:1.743   3rd Qu.:0.8028   3rd Qu.:0.0285548  
#>  Max.   :50.00   Max.   :1.985   Max.   :0.9948   Max.   :0.0381932  
#>     rank_val     rank_y_inter_idx lowest_rank_A   rela_slope_to_lowest
#>  Min.   :1.529   Min.   : 1.00    Min.   :1.122   Min.   :0.7946      
#>  1st Qu.:1.961   1st Qu.:13.25    1st Qu.:1.122   1st Qu.:1.0155      
#>  Median :2.295   Median :25.50    Median :1.122   Median :1.3717      
#>  Mean   :2.302   Mean   :25.50    Mean   :1.122   Mean   :1.8444      
#>  3rd Qu.:2.728   3rd Qu.:37.75    3rd Qu.:1.122   3rd Qu.:2.1876      
#>  Max.   :3.034   Max.   :50.00    Max.   :1.122   Max.   :5.7846      
#>  rela_intercept_to_lowest rela_x_intercept rank_x_inter_idx
#>  Min.   :-6.2816          Min.   :0.0000   Min.   : 1.00   
#>  1st Qu.:-1.4794          1st Qu.:0.3538   1st Qu.:13.25   
#>  Median :-0.8238          Median :0.6277   Median :25.50   
#>  Mean   :-1.1871          Mean   :0.6334   Mean   :25.50   
#>  3rd Qu.:-0.5305          3rd Qu.:0.9831   3rd Qu.:37.75   
#>  Max.   : 0.0000          Max.   :1.2340   Max.   :50.00   
#>  rela_slope_to_lowest_cumsum rela_intercept_to_lowest_cumsum
#>  Min.   : 1.00               Min.   :-59.356                
#>  1st Qu.:30.81               1st Qu.:-28.787                
#>  Median :48.36               Median :-15.944                
#>  Mean   :46.42               Mean   :-19.426                
#>  3rd Qu.:64.62               3rd Qu.: -7.318                
#>  Max.   :92.22               Max.   :  0.000                
#>  rela_slope_to_lowest_cumsum_invert rela_intercept_to_lowest_cumsum_invert
#>  Min.   :0.01084                    Min.   :0.0000                        
#>  1st Qu.:0.01548                    1st Qu.:0.2375                        
#>  Median :0.02068                    Median :0.3296                        
#>  Mean   :0.06883                    Mean   :0.3284                        
#>  3rd Qu.:0.03247                    3rd Qu.:0.4453                        
#>  Max.   :1.00000                    Max.   :0.6436                        
#>  opti_lowest_spline_knots    tot_devi      allocate_lowest  opti_allocate   
#>  Min.   : 0.000           Min.   :-5.681   Min.   :0.4198   Min.   :0.0000  
#>  1st Qu.: 3.586           1st Qu.:-2.095   1st Qu.:0.4198   1st Qu.:0.0000  
#>  Median :14.415           Median : 8.735   Median :0.4198   Median :0.0000  
#>  Mean   :18.657           Mean   :12.976   Mean   :0.4198   Mean   :0.1136  
#>  3rd Qu.:34.778           3rd Qu.:29.097   3rd Qu.:0.4198   3rd Qu.:0.1792  
#>  Max.   :54.438           Max.   :48.758   Max.   :0.4198   Max.   :0.7674  
#>  allocate_total  opti_exp_outcome
#>  Min.   :5.681   Min.   :1.133   
#>  1st Qu.:5.681   1st Qu.:1.357   
#>  Median :5.681   Median :1.471   
#>  Mean   :5.681   Mean   :1.529   
#>  3rd Qu.:5.681   3rd Qu.:1.743   
#>  Max.   :5.681   Max.   :1.985   
print('opti allocation and outcomes rescaled:')
#> [1] "opti allocation and outcomes rescaled:"
print(cbind(ar_opti_expout_cv, ar_opti_inpalc_cv))
#>       ar_opti_expout_cv ar_opti_inpalc_cv
#>  [1,]       -0.47697041        -0.5054186
#>  [2,]       -1.77230323        -0.1758999
#>  [3,]       -1.21411292         1.1897164
#>  [4,]       -1.49694697         0.7905109
#>  [5,]       -1.55132935         2.5553866
#>  [6,]       -1.17469967         0.8701127
#>  [7,]       -0.37009985         0.7862745
#>  [8,]       -1.08736303         3.0307189
#>  [9,]       -0.35469088         0.4725188
#> [10,]       -1.11182370         1.1955980
#> [11,]       -0.23982655         1.1018068
#> [12,]       -0.93105662         3.0958980
#> [13,]       -0.43051770         1.9761892
#> [14,]       -0.92275606         0.9966704
#> [15,]       -0.14161660         1.4498997
#> [16,]       -0.93473940        -0.5379995
#> [17,]       -1.52881698        -0.5379995
#> [18,]       -0.39987017        -0.5379995
#> [19,]       -0.07895443        -0.5379995
#> [20,]       -0.42198405        -0.5379995
#> [21,]       -0.38926583        -0.5379995
#> [22,]       -0.24098836        -0.5379995
#> [23,]        0.14242201        -0.5379995
#> [24,]        0.60882549        -0.5379995
#> [25,]        0.62199096        -0.5379995
#> [26,]       -0.66858501        -0.5379995
#> [27,]       -0.69255621        -0.5379995
#> [28,]       -0.36098506        -0.5379995
#> [29,]       -0.79403702        -0.5379995
#> [30,]       -0.27921473        -0.5379995
#> [31,]       -0.64998971        -0.5379995
#> [32,]        1.00893028        -0.5379995
#> [33,]        1.00370377        -0.5379995
#> [34,]        0.44811162        -0.5379995
#> [35,]        1.15991292        -0.5379995
#> [36,]        0.55503668        -0.5379995
#> [37,]        0.81061166        -0.5379995
#> [38,]        1.18743351        -0.5379995
#> [39,]        1.20795153        -0.5379995
#> [40,]        1.59992639        -0.5379995
#> [41,]        2.04090113        -0.5379995
#> [42,]        0.57140715        -0.5379995
#> [43,]        0.37445699        -0.5379995
#> [44,]        1.25782812        -0.5379995
#> [45,]        1.63832633        -0.5379995
#> [46,]        1.62939720        -0.5379995
#> [47,]        1.27831552        -0.5379995
#> [48,]       -0.83111674        -0.5379995
#> [49,]        1.26823889        -0.5379995
#> [50,]        1.13348910        -0.5379995