Skip to contents

Concatenate classic and PROBIT estimates into a single data.frame

Usage

merge_op(x, y, prop2percent = FALSE)

Arguments

x

Classic estimates data frame

y

Probit estimates data frame

prop2percent

Logical. Should proportion type indicators be converted to percentage? Default is FALSE.

Value

A data.frame() of combined classic and probit estimates.

Author

Ernest Guevarra

Examples

indicators <- c(
  "demo", "anthro", "food", "hunger", "adl", "disability",
  "mental", "dementia", "health", "oedema", "screening", "income",
  "wash", "visual", "misc"
)

classicIndicators <- indicators[indicators != "anthro"]

## Bootstrap classic
classicEstimates <- estimate_classic(
  x = indicators.ALL, w = testPSU, 
  indicators = classicIndicators, replicates = 9
)
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure

probitEstimates <- estimate_probit(
  x = indicators.ALL, w = testPSU, replicates = 9
)
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure
#>  x has the appropriate/expected data structure

merge_op(x = classicEstimates, y = probitEstimates)
#> # A tibble: 139 × 13
#>    INDICATOR GROUP       LABEL TYPE  EST.ALL LCL.ALL UCL.ALL EST.MALES LCL.MALES
#>    <fct>     <fct>       <fct> <fct>   <dbl>   <dbl>   <dbl>     <dbl>     <dbl>
#>  1 resp1     Survey      Resp… Prop…  0.854   0.829   0.896     0.818    0.707  
#>  2 resp2     Survey      Resp… Prop…  0.0885  0.0604  0.127     0.0864   0.0501 
#>  3 resp3     Survey      Resp… Prop…  0.0417  0.0229  0.0729    0.0741   0.0157 
#>  4 resp4     Survey      Resp… Prop…  0.0104  0       0.0240    0.0282   0.00247
#>  5 age       Demography… Mean… Mean  70.5    69.6    72.3      71.9     70.7    
#>  6 ageGrp1   Demography… Self… Prop…  0       0       0         0        0      
#>  7 ageGrp2   Demography… Self… Prop…  0.547   0.456   0.576     0.465    0.396  
#>  8 ageGrp3   Demography… Self… Prop…  0.229   0.209   0.278     0.268    0.226  
#>  9 ageGrp4   Demography… Self… Prop…  0.182   0.130   0.280     0.197    0.140  
#> 10 ageGrp5   Demography… Self… Prop…  0.0417  0.0125  0.0469    0.0617   0.0274 
#> # ℹ 129 more rows
#> # ℹ 4 more variables: UCL.MALES <dbl>, EST.FEMALES <dbl>, LCL.FEMALES <dbl>,
#> #   UCL.FEMALES <dbl>