[R] R Base Code
Ben Bolker
bbolker at gmail.com
Mon Aug 9 15:46:15 CEST 2010
nancy_shackelford <nancy.shackelford <at> gmail.com> writes:
> Hello all,
>
> I need to imitate the 'q' function (qnorm, qweibull, etc) for Clark's 2Dt
> distribution model. I'm not skilled enough in R to code it myself, so I
> thought I could find the base code for one of the existing 'q' functions and
> just modify it. However, I'm having trouble navigating through the R Source
> Code on the CRAN website. I've searched some forum and help sites, but I
> can't find anything specific on locating function codes.
>
> I also read somewhere that Clark's 2Dt is available in the R distribution
> functions, but I haven't found anything that confirms that.
You can find the C source code for qt in
http://svn.r-project.org/R/trunk/src/nmath/qt.c
and the R code is in
http://svn.r-project.org/R/trunk/src/library/stats/R/distn.R
but I don't think this is really what you want. As pointed out
in Clark et al 1999 (Ecology), the "Clark 2Dt" function is just a bivariate
version of the univariate t-distribution. I think that if you stare at
the equations in Clark et al 1999 and (e.g.) in ?dt you can probably
adapt the existing pt/qt functions to get where you need, adjusting
normalizing constants as appropriate ...
PS: when asking questions about field-specific topics on the
general R list, it's a good idea to give a little more background --
even references, in case someone is interested. Few people outside
of community ecology have heard of "Clark's 2Dt" ...
good luck,
Ben Bolker
More information about the R-help
mailing list