R/ffy_opt_dtgch.R
ffy_opt_dtgch_cbem4.Rd
Given a dataset with Y, x1, xothers. Regress with log linear and linear structures to obtain A and alpha that the linear and log linear optimal allocation problems understand. dtgch = data guatemala cebu height. There discrete groups, allowing for alpha to differ. *ffv_opt_dtgch_cbem4.Rmd* tests the code here and generates rda file that is saved in data folder.
ffy_opt_dtgch_cbem4()
a list with two tibble with guatemala and cebu dataset only some columns and A and alpha lin loglin
df_raw - Dataframe from Guat/Cebu subsetted Ceb only, 4 categories
df_esti - A dataframe with 5 columns, lin and loglin A, alpha and beta.
https://fanwangecon.github.io/PrjOptiAlloc/reference/ffy_opt_dtgch_cbem4.html https://fanwangecon.github.io/PrjOptiAlloc/articles/ffv_opt_dtgch_cbem4.html
ls_opti_alpha_A <- ffy_opt_dtgch_cbem4()
head(ls_opti_alpha_A$df_raw, 10)
#> # A tibble: 10 x 17
#> S.country vil.id indi.id sex svymthRound momEdu wealthIdx hgt wgt
#> <chr> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Cebu 1 2 Female 24 7.1 7.3 79.2 10776.
#> 2 Cebu 1 3 Female 24 9.4 10.3 76.7 10296.
#> 3 Cebu 1 4 Female 24 13.9 13.3 78.1 7604.
#> 4 Cebu 1 5 Male 24 11.3 9.3 84.1 11787.
#> 5 Cebu 1 6 Female 24 7.3 7.3 76.9 7991.
#> 6 Cebu 1 7 Male 24 10.4 8.3 79.6 12583.
#> 7 Cebu 1 8 Female 24 13.5 9.3 81.5 8358.
#> 8 Cebu 1 9 Female 24 10.4 17.3 74.7 8195.
#> 9 Cebu 1 10 Male 24 10.5 6.3 77.1 9442.
#> 10 Cebu 1 11 Male 24 1.9 6.3 72.1 6627.
#> # ... with 8 more variables: hgt0 <dbl>, wgt0 <dbl>, prot <dbl>, cal <dbl>,
#> # p.A.prot <dbl>, p.A.nProt <dbl>, momEduRound <fct>, hgt0med <fct>
head(ls_opti_alpha_A$df_esti, 10)
#> # A tibble: 10 x 9
#> S.country vil.id indi.id svymthRound alpha_lin alpha_log A_lin A_log beta
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Cebu 1 2 24 0.0101 0.00669 78.4 4.34 0.000959
#> 2 Cebu 1 3 24 0.0323 0.00925 79.9 4.36 0.000959
#> 3 Cebu 1 4 24 0.0323 0.00925 78.9 4.35 0.000959
#> 4 Cebu 1 5 24 0.0662 0.0139 80.6 4.37 0.000959
#> 5 Cebu 1 6 24 0.0101 0.00669 77.8 4.34 0.000959
#> 6 Cebu 1 7 24 0.0662 0.0139 79.6 4.36 0.000959
#> 7 Cebu 1 8 24 0.0101 0.00669 77.8 4.34 0.000959
#> 8 Cebu 1 9 24 0.0101 0.00669 78.0 4.34 0.000959
#> 9 Cebu 1 10 24 0.0662 0.0139 80.0 4.36 0.000959
#> 10 Cebu 1 11 24 0.0602 0.0121 77.7 4.33 0.000959