2 parameter exponential distribution
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 <bolker at ufl.edu
<mailto:bolker at 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 at r-project.org <mailto:R-help at 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 bolker at ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100111/d921c316/attachment.bin>