R/ff_dist_integrate.R
ff_dist_integrate_normal.Rd
Supose epsilon follows the normal distribution. Draw it_eps number of normal shocks that best approximates the normal distribution. Outputs a number of statistics to check to quality of approximation
ff_dist_integrate_normal(fl_eps_mean = 0, fl_eps_sd = 1, it_eps = 10)
float mean of the normal distribution
float sd of the normal distribution
integer number of discretized points to return
a list of normal draw arrays and checks
ar_eps_val - An array of shock draws as Discrete Random Variable
ar_eps_prb - The probability mass for each discrete point
fl_cdf_total_approx - Approximated aggregate probability
fl_mean_approx - Approximated mean given draws array
fl_sd_approx - Approximated standard deviation given draws array
https://fanwangecon.github.io/REconTools/reference/ff_dist_integrate_normal.html https://github.com/FanWangEcon/REconTools/blob/master/R/ff_dist_integrate.R
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=3)
#> $ar_eps_val
#> [1] 10.41311 60.00000 109.58689
#>
#> $ar_eps_prb
#> [1] 0.04575206 0.98911528 0.04575206
#>
#> $fl_cdf_total_approx
#> [1] 1.080619
#>
#> $fl_mean_approx
#> [1] 64.83716
#>
#> $fl_sd_approx
#> [1] 15.82025
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=5)
#> $ar_eps_val
#> [1] 0.4957362 30.2478681 60.0000000 89.7521319 119.5042638
#>
#> $ar_eps_prb
#> [1] 0.0070996 0.1962714 0.5934692 0.1962714 0.0070996
#>
#> $fl_cdf_total_approx
#> [1] 1.000211
#>
#> $fl_mean_approx
#> [1] 60.01267
#>
#> $fl_sd_approx
#> [1] 19.94369
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=7)
#> $ar_eps_val
#> [1] -3.754568 17.496954 38.748477 60.000000 81.251523 102.503046 123.754568
#>
#> $ar_eps_prb
#> [1] 0.002634535 0.044317380 0.241043882 0.423906548 0.241043882 0.044317380
#> [7] 0.002634535
#>
#> $fl_cdf_total_approx
#> [1] 0.9998981
#>
#> $fl_mean_approx
#> [1] 59.99389
#>
#> $fl_sd_approx
#> [1] 19.9815
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=9)
#> $ar_eps_val
#> [1] -6.115849 10.413114 26.942076 43.471038 60.000000 76.528962 93.057924
#> [8] 109.586886 126.115849
#>
#> $ar_eps_prb
#> [1] 0.001396636 0.015250686 0.084113380 0.234320623 0.329705093 0.234320623
#> [7] 0.084113380 0.015250686 0.001396636
#>
#> $fl_cdf_total_approx
#> [1] 0.9998677
#>
#> $fl_mean_approx
#> [1] 59.99206
#>
#> $fl_sd_approx
#> [1] 19.97717
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=11)
#> $ar_eps_val
#> [1] -7.618482 5.905215 19.428911 32.952607 46.476304 60.000000
#> [7] 73.523696 87.047393 100.571089 114.094785 127.618482
#>
#> $ar_eps_prb
#> [1] 0.0008888774 0.0069568074 0.0344673097 0.1081020936 0.2146298569
#> [6] 0.2697587123 0.2146298569 0.1081020936 0.0344673097 0.0069568074
#> [11] 0.0008888774
#>
#> $fl_cdf_total_approx
#> [1] 0.9998486
#>
#> $fl_mean_approx
#> [1] 59.99092
#>
#> $fl_sd_approx
#> [1] 19.9746
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=13)
#> $ar_eps_val
#> [1] -8.658766 2.784362 14.227489 25.670617 37.113745 48.556872
#> [7] 60.000000 71.443128 82.886255 94.329383 105.772511 117.215638
#> [13] 128.658766
#>
#> $ar_eps_prb
#> [1] 0.0006299853 0.0038130799 0.0166360231 0.0523180089 0.1185989893
#> [6] 0.1937933439 0.2282573719 0.1937933439 0.1185989893 0.0523180089
#> [11] 0.0166360231 0.0038130799 0.0006299853
#>
#> $fl_cdf_total_approx
#> [1] 0.9998362
#>
#> $fl_mean_approx
#> [1] 59.99017
#>
#> $fl_sd_approx
#> [1] 19.97299
#>
ff_dist_integrate_normal(fl_eps_mean=60, fl_eps_sd = 20, it_eps=15)
#> $ar_eps_val
#> [1] -9.4216411 0.4957362 10.4131135 20.3304908 30.2478681 40.1652454
#> [7] 50.0826227 60.0000000 69.9173773 79.8347546 89.7521319 99.6695092
#> [13] 109.5868865 119.5042638 129.4216411
#>
#> $ar_eps_prb
#> [1] 0.0004786276 0.0023665335 0.0091504114 0.0276682494 0.0654238116
#> [6] 0.1209770806 0.1749377169 0.1978230557 0.1749377169 0.1209770806
#> [11] 0.0654238116 0.0276682494 0.0091504114 0.0023665335 0.0004786276
#>
#> $fl_cdf_total_approx
#> [1] 0.9998279
#>
#> $fl_mean_approx
#> [1] 59.98968
#>
#> $fl_sd_approx
#> [1] 19.97194
#>