[R] asypow.noncent: how does it work?
Kjetil Brinchmann Halvorsen
kjetil at acelerate.com
Tue Sep 21 21:16:07 CEST 2004
david_foreman at doctors.org.uk wrote:
>I am trying to do power calculations for the proportional odds model using the asypow library.
>
>The code
>
>noncenta90b10<-asypow.noncent(theta.ha=a9010,info.mat=infomatrixa90b10,constraints=constrt)
>
>returns
>
>Error in max(..., na.rm = na.rm) : invalid "mode" of argument.
>
>the various arguments I've used are:
> a9010
> [,1]
>[1,] -1.7357568
>[2,] -0.1928619
>specifying the theta.ha array as a row not a column makes no difference
>
>
>
>
>>infomatrixa90b10
>>
>>
> [,1] [,2]
>[1,] 0.967005807 -0.004699262
>[2,] -0.004699262 0.903852346
>
>
>
>>constrt
>>
>>
> [,1] [,2] [,3]
>[1,] "1" "a" "-1.92861865194525"
>[2,] "1" "b" "0"
>
>
>I'm probably missing something very simple, but I can't see what it is. Can anyone help?
>
>
>
Problem is with your constarint matrix. From the help file (which
admittedlt could be clearer)
constrain is a 3-column matrix. First element in a row should be 1 to
indicate a param set == to a value,
2 to indicate equality of two params. You put 1, so we assume first
case. Second row element should be , in this case,
index of param set to value, and cannot be "a" or "b". Lets suppose
yours are first and second parameter, then it shoud be 1 and 2,
respectively.
Finally, in this case, third row element should be value.
So you should use something like
constrt <- matrix( c(1,1,-1.9286, 1,2,0), 2, 3, byrow=TRUE)
and then, using your values for the other arguments,
> asypow.noncent(a9010, infomatrix, constrt)
$w
[,1]
[1,] 0.06993048
$df
[1] 2
Kjetil
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
-- Mahdi Elmandjra
More information about the R-help
mailing list