Greetings all, I'm trying to figure out how to calculate the inverse CDF (i.e. a quantile) for a non-central F distribution. I could put together a quick numerical solver routine using the CDF, but I wonder if there's a function that I've missed that would be more efficient? Thank-you, Andrew Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion.
At least you could get reasonable starting values from qchisq. (If you also needed it to work in S-Plus, then you would need to port R's "qchisq" to S-Plus.) Spencer Graves Andrew Robinson wrote:> Greetings all, > > I'm trying to figure out how to calculate the inverse CDF (i.e. a > quantile) for a non-central F distribution. I could put together a quick > numerical solver routine using the CDF, but I wonder if there's a function > that I've missed that would be more efficient? > > Thank-you, > > Andrew > > Andrew Robinson Ph: 208 885 7115 > Department of Forest Resources Fa: 208 885 6226 > University of Idaho E : andrewr at uidaho.edu > PO Box 441133 W : http://www.uidaho.edu/~andrewr > Moscow ID 83843 Or: http://www.biometrics.uidaho.edu > No statement above necessarily represents my employer's opinion. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Andrew Robinson <andrewr at uidaho.edu> writes:> Greetings all, > > I'm trying to figure out how to calculate the inverse CDF (i.e. a > quantile) for a non-central F distribution. I could put together a quick > numerical solver routine using the CDF, but I wonder if there's a function > that I've missed that would be more efficient?If we had one, then there would have been an 'ncp' argument to qf().... In my experience, uniroot() gets you there fast enough in most cases:> uniroot(function(x)pf(x,ncp=3,4,20)-.995,c(0,1000))$root[1] 8.301055 (BTW: That chased up a few buglets:> pf(Inf,ncp=3,4,20)[1] NaN Warning message: NaNs produced in: pnf(q, df1, df2, ncp, lower.tail, log.p) Whereas> pf(Inf,4,20)[1] 1 which would also be a sensible result in the noncentral case. Also -- and what I was trying -- it would be great if uniroot accepted infinite limits, but it doesn't. Shouldn't be too hard...) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907