non-central chi-square probability and non-centrality parameter

前端 未结 1 1288
南方客
南方客 2021-01-19 01:12

How can I get the value of the non-centrality parameter that gives a probability of exactly 0.9 for different critical values and degrees of freedom?

For example, w

相关标签:
1条回答
  • 2021-01-19 01:52

    Rearrange terms in: 1 - pchisq(3.841459, 1, 10.50742) = 0.9 and wrap abs around the result to construct a minimization function:

     optim( 1, function(x) abs(pchisq(3.841459, 1, x)  - 0.1) )
    #-------
    $par
    [1] 10.50742
    
    $value
    [1] 1.740301e-08
    
    $counts
    function gradient 
          56       NA 
    
    $convergence
    [1] 0
    
    $message
    NULL
    

    To do a sensitivity analysis, you can serially alter the values of the 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
    
    0 讨论(0)
提交回复
热议问题