Rearrange the terms in: 1 - pchisq (3.841459, 1, 10.50742) = 0.9 and wrap around the result to build a minimization function:
optim( 1, function(x) abs(pchisq(3.841459, 1, x) - 0.1) )
To perform a sensitivity analysis, you can subsequently change the values ββof other parameters:
for( crit.val in seq(2.5, 3.5, by=0.1)) { print( optim( 1, function(x) abs(pchisq(crit.val, 1, x) - 0.1), method="Brent" , lower=0, upper=20)$par)} [1] 8.194852 [1] 8.375145 [1] 8.553901 [1] 8.731204 [1] 8.907135 [1] 9.081764 [1] 9.255156 [1] 9.427372 [1] 9.598467 [1] 9.768491 [1] 9.937492
source share