Sent: Tuesday, August 26, 2008 1:01 AM
To: r-help@r-project.org
Subject: [R] Problem with Integrate for NEF-HS distribution
I need to calcuate the cumulative probability for the Natural Exponential
Family - Hyperbolic secant distribution with a parameter theta between -pi/2
and pi/2
: [R] Problem with Integrate for NEF-HS distribution
Date: Tue, 26 Aug 2008 11:59:44 -0400
Hi,
Simply re-write your integrand as follows:
integrand - function(X) {0.5 * cos(theta) * 2 / (exp(-pi*X/2 - X*theta) +
exp(pi*X/2 - X*theta)) }
Now the problem goes away.
theta - -1
distribution
To: [EMAIL PROTECTED]
Shouldn't you define
integrand - function(X,theta) ..
and not
integrand - function(X) .
--- On Tue, 26/8/08, xia wang [EMAIL PROTECTED] wrote:
From: xia wang [EMAIL PROTECTED]
Subject: [R] Problem with Integrate for NEF-HS distribution
Varadhan
Cc: r-help@r-project.org
Subject: RE: [R] Problem with Integrate for NEF-HS distribution
Thanks so much. It works well in my MCMC sampling. May I know why
re-writing the integrand can solve the problem? I have been thinking it was
the skewness of the distribution brought the error
Got it. Thanks so much!
Xia
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: r-help@r-project.org
Subject: RE: [R] Problem with Integrate for NEF-HS distribution
Date: Tue, 26 Aug 2008 14:50:18 -0400
Try the following:
sech-function(X)
2/(exp(-X)+exp(X))
your.integrand
)
}
Date: Tue, 26 Aug 2008 00:49:02 -0700
From: [EMAIL PROTECTED]
Subject: Re: [R] Problem with Integrate for NEF-HS
distribution
To: [EMAIL PROTECTED]
Shouldn't you define
integrand - function(X,theta) ..
and not
integrand - function(X) .
--- On Tue, 26/8/08, xia
I need to calcuate the cumulative probability for the Natural Exponential
Family - Hyperbolic secant distribution with a parameter theta between -pi/2
and pi/2. The integration should be between 0 and 1 as it is a probability.
The function integrate works fine when the absolute value of
7 matches
Mail list logo