
Applied methods: FTC integral, Fredholm inverse problem, scale-test ARE, custody credit, posterior variances, utility shocks, PMM, TD3 and CV2
Source:R/AppliedMethodsLegacy.R
definite_integral.Rddefinite_integral is F(b) - F(a) with F from SymbolicIntegrate
(a composite Simpson value is reported as a check and used when no
antiderivative is found); horowitz_fredholm_eq the Tikhonov solution
(A'A + alpha I)^-1 A'm of a discretised Fredholm equation of the first
kind; gibbons_are_scale_tests the ARE of Mood's (15/(2 pi^2)) and
Klotz's (1) scale tests against F at the normal; custody_days_credit
the s. 719(3.1) enhanced credit (ratio in 1 to 1.5, R v Summers);
irt_variance_legislator posterior variances of MCMC draws by column;
simulate_utility_shocks Gumbel or normal random-utility errors from
Philox uniforms; mi_pmm predictive mean matching; td3 a front-end to
morie_geron_td3; cv2_genomic CV2 cross-validation of RR-BLUP with
environment effects.
Usage
definite_integral(expr, x = "x", a = 0, b = 1, n_check = 2000)
horowitz_fredholm_eq(m, k, alpha = 0.001, weights = NULL)
gibbons_are_scale_tests(distribution = "normal")
custody_days_credit(pretrial_days, credit_ratio = 1.5)
irt_variance_legislator(chain_theta)
simulate_utility_shocks(n = 100, sigma = 1, dist = "gumbel", seed = 0)
mi_pmm(y, X, R, K = 5, seed = 0)
td3(env, actor = NULL, critic1 = NULL, critic2 = NULL, ...)
cv2_genomic(y, markers, env, n_folds = 5, lam = 1, seed = 0)Arguments
- expr
Elementary expression in
x.- x
Variable name (or input matrix / data for the other functions).
- a, b
Integration limits.
- n_check
Simpson panels.
- m, k, alpha, weights
Fredholm right-hand side, kernel matrix, Tikhonov parameter and quadrature weights.
- distribution
Only "normal".
- pretrial_days, credit_ratio
Days in pre-sentence custody and ratio.
- chain_theta
Draws by legislators.
- n, sigma, dist, seed
Number of draws, scale, "gumbel" or "normal", Philox seed.
- y, X, R, K
Outcome, covariates, response indicator, donor pool size.
- env, actor, critic1, critic2, ...
Environment, initial policy and critics, further arguments of
morie_geron_td3.- markers, n_folds, lam
Marker rows, number of folds, ridge penalty.
References
Apostol, T. M. (1967). Calculus, vol. 1. Wiley. Tikhonov, A. N. (1963). Solution of incorrectly formulated problems and the regularization method. Soviet Mathematics Doklady 4, 1035-1038. Gibbons, J. D. and Chakraborti, S. (2021). Nonparametric Statistical Inference, 6th ed. CRC Press. R. v. Summers, 2014 SCC 26. Clinton, J., Jackman, S. and Rivers, D. (2004). The statistical analysis of roll call data. APSR 98, 355-370. Train, K. E. (2009). Discrete Choice Methods with Simulation. Cambridge University Press. Little, R. J. A. (1988). Missing-data adjustments in large surveys. JBES 6, 287-296. Fujimoto, S., van Hoof, H. and Meger, D. (2018). Addressing function approximation error in actor-critic methods. ICML. Burgueno, J. et al. (2012). Genomic prediction of breeding values when modeling genotype x environment interaction. Crop Science 52, 707-719.
Examples
definite_integral("x*exp(2*x)", "x", 0, 1)$estimate
#> [1] 2.097264
custody_days_credit(c(10, 30, 45))$credited
#> [1] 15.0 45.0 67.5