Displaying 20 results from an estimated 49 matches for "infty".
2010 Apr 14
2
Gaussian Quadrature Numerical Integration In R
Hi All,
I am trying to use A Gaussian quadrature over the interval (-infty,infty) with weighting function W(x)=exp(-(x-mu)^2/sigma) to estimate an integral.
Is there a way to do it in R? Is there a function already implemented which uses such weighting function.
I have been searching in the statmode package and I found the function "gauss.quad(100, kind="hermit...
2011 Nov 06
2
how to use quadrature to integrate some complicated functions
...ng trouble with intregrating a complicated uni-dimensional function
of the following form
Phi(x-a_1)*Phi(x-a_2)*...*Phi(x-a_{n-1})*phi(x-a_n).
Here n is about 5000, Phi is the cumulative distribution function of
standard normal,
phi is the density function of standard normal, and x ranges over
(-infty,infty).
My idea is to to use quadrature to handle this integral. But since Phi has
not cloaed form,
I don't know how to do this effeciently. I appreciate very much if someone
has any ideas about it.
Thanks!
Jeff
--
View this message in context: http://r.789695.n4.nabble.com/how-to-use-quadr...
2012 Feb 29
2
Converting a function from Splus to R
...has the elements "0.d0" and "2.d0". How can I change it
to run in R?
The function can be found in page 230 from
http://www.stat.wisc.edu/~mchung/teaching/stat471/stat_computing.pdf
Function is as follows:
gauher <- function(n) {# Gauss-Hermite: returns x,w so that
#\int_-\infty^\infty exp(-x^2) f(x) dx \doteq \sum w_i f(x_i)
EPS <- 3.e-14
PIM4 <- .7511255444649425D0
MAXIT <- 10
m <- trunc((n+1)/2)
x <- w <- rep(-1,n)
for (i in 1:m) {
if (i==1) {
z <- sqrt(2*n+1)-1.85575*(2*n+1)^(-.16667)
} else if(i==2) {
z <- z-1.14*n^.426/z
} else if (i==3) {
z &...
2009 Dec 06
5
optim with constraints
Hi, dear R users
I am a newbie in R and I wantto use the method of meximum likelihood
to fit a Weibull distribution to my survival data. I use "optim" as
follows:
optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian
= TRUE)
My question is: how do I setup the constraints so that the two
parametrs of Weibull to be pisotive? Or should I use other function
2006 Oct 02
1
Trig.Rd typo (PR#9269)
...ersion: 2.4.0 RC
OS: MacOSX 10.4.7
Submission from: (NULL) (139.166.242.29)
The first cut line described in Trig.Rd for asin() is incorrect in the ascii
version of the manpage.
The Rd file reads:
For \code{asin()} and \code{acos()}, there are two cuts, both along
the real axis: \eqn{\left(-\infty, -1\right]}{\(-Inf, 1\]} and
Note the inconsistency between the ascii and latex equations.
It should read:
For \code{asin()} and \code{acos()}, there are two cuts, both along
the real axis: \eqn{\left(-\infty, -1\right]}{\(-Inf, -1\]} and
where the final "1" has been changed to a...
2012 May 23
1
numerical integration
Greetings,
Sorry, the last message was sent by mistake! Here it is again:
I encounter a strange problem computing some numerical integrals on [0,oo).
Define
$$
M_j(x)=exp(-jax)
$$
where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products
$$
A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx
$$
Analytically we have
$$
A_{ij}=1/(a(i+j)).
$$
In the code below we compute the matrix $A_{i,j}$, $1\leq i,j\leq 5$, numerically
and check against the known analytic values.
When I run this code most components of A are correct,...
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list,
I'm seeking some advice regarding a particular numerical integration I
wish to perform.
The integrand f takes two real arguments x and y and returns a vector
of constant length N. The range of integration is [0, infty) for x and
[a,b] (finite) for y. Since the integrand has values in R^N I did not
find a built-in function to perform numerical quadrature, so I wrote
my own after some inspiration from a post in R-help,
library(statmod)
## performs 2D numerical integration
## using Gauss-Legendre quadrature
## wi...
2006 Nov 18
1
Questions regarding "integrate" function
Hi there. Thanks for your time in advance.
I am using R 2.2.0 and OS: Windows XP.
My final goal is to calculate 1/2*integral of
(f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes:
$\frac{1}{2}\int^{{\infty}}_{\infty}
(\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two
marginal densities.
My problem:
I have the following R codes using "adapt" package. Although "adapt"
function is mainly designed for more than 2 dimensions, the manual
says it will also call up &quo...
2008 Mar 12
3
Types of quadrature
Dear R-users
I would like to integrate something like \int_k^\infty (1 - F(x)) dx, where F(.) is a cumulative distribution function. As mentioned in the "integrate" help-page: integrate(dnorm,0,20000) ## fails on many systems. This does not happen for an adaptive Simpson or Lobatto quadrature (cf. Matlab). Even though I am hardly familiar with numerical i...
2008 Jan 07
2
chi-squared with zero df (PR#10551)
Full_Name: Jerry W. Lewis
Version: 2.6.1
OS: Windows XP Professional
Submission from: (NULL) (24.147.191.250)
pchisq(0,0,ncp=lambda) returns 0 instead of exp(-lambda/2)
pchisq(x,0,ncp=lambda) returns NaN instead of exp(-lambda/2)*(1 +
SUM_{r=0}^infty ((lambda/2)^r / r!) pchisq(x, df + 2r))
qchisq(.7,0,ncp=1) returns 1.712252 instead of 0.701297103
qchisq(exp(-1/2),0,ncp=1) returns 1.238938 instead of 0
2003 Sep 16
1
calculation of the p value in ks.test()
...d.) pg 631.
The p value produced by the NRC code is generally larger than that
produced by R by a factor of 10. Currently I am not in a position to
download the R source and look at it - lack of space :(
has anybody used the NRC code? The text mentions that it calculates the
sum
Q(L) = 2 \sum^{-\infty}_{j=1} (-1)^(j-1) \exp^{-2 j^2 L^2}
and the value of L is given by
[ sqrt(n) + 0.12 + 0.11 / sqrt(n) ] * D
where n = n1*n2/(n1+n2) .. n1, n2 are lengths of the vectors
and D is the calculated statistic.
Is this the same definition as used in R?
Thanks,
----------------------------------------...
2006 Nov 17
0
Question regarding "integrate" function
Hi there. Thanks for your time in advance.
My final goal is to calculate 1/2*integral of
(f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes:
$\frac{1}{2}\int^{{\infty}}_{\infty} (\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx
$.) where f1(x) and f2(x) are two estimated marginal densities.
My problem:
I have the following R codes using "adapt" package. Although "adapt"
function is mainly designed for more than 2 dimensions, the manual
says it will also ca...
2006 Nov 17
0
questions regarding "integrate" function in R
Hi there. Thanks for your time in advance.
My final goal is to calculate 1/2*integral of
(f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes:
$\frac{1}{2}\int^{{\infty}}_{\infty}
(\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two
marginal densities.
My problem:
I have the following R codes using "adapt" package. Although "adapt"
function is mainly designed for more than 2 dimensions, the manual
says it will also call up &quo...
2009 Dec 10
1
MLE for a t distribution
Given X1,...,Xn ~ t_k(mu,sigma) student t distribution with k degrees
of freedom, mean mu and standard deviation sigma, I want to obtain the
MLEs of the three parameters (mu, sigma and k). When I try traditional
optimization techniques I don't find the MLEs. Usually I just get
k->infty. Does anybody know of any algorithms/functions in R that can
help me obtain the MLEs? I am especially interested in the MLE for k,
the degrees of freedom.
Thank you!
Barbara
2010 May 10
1
Polylogarithm
I am writing to ask if R has a build- in function to calculate this
polylogarithm Li_n(z) function , also known as the Jonqui?re's function
defined as
Li_n(z)=sum_(k=1)^infty(z^k)/(k^n)
Thanks
Andy
2002 Dec 01
1
SYSLINUX COM32 example in assembly (NASM)
...sing COM32 API ?
I'm trying to make simple "Hello World" using COM32, but this code does not
works 8-(
org 0x101000 ; this number I get from comboot.doc
_start:
mov ecx,msge-msg
mov ebx,msg
mov ah,0x02
.L:
mov dl, byte [ebx]
inc ebx
int 0x21
loop .L
.Z: jmp .Z ; \infty loop
msg: db "Hello World !"
msge:
END
What Do I do incorrect ?
PS: I use NASM 0.98
2012 May 23
0
numerical integrals
Greetings,
I encounter a strange problem computing some numerical integrals on [0,oo).
Define
$$
M_j(x)=exp(-jax)
$$
where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products
$$
A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx
$$
Analytically we have
$$
A_{ij}=1/(a(i+j)).
$$
In the code below we compute the matrix $A_{i,j}$, $1\leq i,j\leq 5$, numerically
and check against the known analytic values.
When I run this code most components of A are correct...
1997 Jul 28
0
R-alpha: R 0.50.a1: patch for NChisquare documentation
...ibution function LANG(qnchisq) gives the quantile
function and LANG(rnchisq) generates random deviates.
PARA
! The non-central chi-square distribution with EQN(df) degrees of freedom
! and non-centrality parameter EQN(greeklambda) has density
! DEQN(f(x) = SUP(e @@ -\lambda / 2)
! \sum_{r=0}^\infty \frac{\lambda^r}{2^r r!} \mathrm{pchisq}(x, df + 2r)
! @@
! f(x) = exp(-lambda/2) SUM_{r=0}^infty (lambda^r / 2^r r!)
! pchisq(x, df + 2r)
! )
for EQN(x GE 0).
)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwi...
2011 Mar 16
2
Re; Fitting a Beta distribution
I want to fit some p-values to a beta distribution. But the problem is some
of the values have 0s and 1's. I am getting an error if I use the MASS
function to do this. Is there anyway to get around this?
--
Thanks,
Jim.
[[alternative HTML version deleted]]
2006 Jun 04
3
Absolutize URLs in a string
I wonder - do we have some helper/processor/gem to automatically
convert all URLs in a passed string to their canonical equivalent -
i.e. with the protocol, host and such prepended based on the Rails
environment. Super-duper infty for RSS feeds (I hate their
requirement for canonical URLs everywhere).
--
Julian ''Julik'' Tarkhanov
please send all personal mail to
me at julik.nl