John Westbury wrote: > Ben, > > Say you have some variable (x) ~ exp f(x|lambda,theta) where f(x|lambda, > theta) = lamba*(e^(minus lambda*(x-theta))) > > Lambda is the inverse scale parameter and theta is a location parameter > (I erred in calling theta a shape parameter in the original question). > > John
Presumably P(x)=0 for x<theta? In which case dexp2 <- function(x,rate=1,loc=0,log=FALSE) { dexp(x-loc,rate=rate,log=log) } rexp2 <- function(n,rate=1,loc=0) { rexp(n,rate=rate)+loc } etc. It turns out that dexp(x) gives 0/-Inf for x<0 (I thought it would give a warning, but it doesn't), so this is relatively simple. Of course the next question is what you actually want to do with this distribution ... > > On Mon, Jan 11, 2010 at 4:23 PM, Ben Bolker <bol...@ufl.edu > <mailto:bol...@ufl.edu>> wrote: > > John Westbury <jrwestbury <at> gmail.com <http://gmail.com>> writes: > > > > > Hello, > > > > I am new to R and am trying to figure out how to specify an > exponential > > distribution with scale and shape parameters. I can specify an > exponential > > distribution with an inverse scale but would like to know how to > specify the > > distribution with a shape parameter as well. > > > > thanks much, > > > > John > > > > Do you mean a gamma distribution? I'm unfamiliar with any > definition of the exponential distribution with more than one > parameter. Can you point to a reference/example somewhere? > > Ben Bolker > > ______________________________________________ > R-help@r-project.org <mailto:R-help@r-project.org> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- Ben Bolker Associate professor, Biology Dep't, Univ. of Florida bol...@ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
signature.asc
Description: OpenPGP digital signature
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.