Displaying 20 results from an estimated 18519 matches for "integrer".
Did you mean:
integer
2008 Aug 21
2
Help Regarding 'integrate'
I have an R function defined as:
f<-function(x){
return(dchisq(x,9,77)*((13.5/x)^5)*exp(-13.5/x))
}
Numerically integrating this function, I observed a couple of things:
A) Integrating the function f over the entire positive real line gives an
error:
> integrate(f,0,Inf)
Error in integrate(f, 0, Inf) : the integral is probably divergent
B) Increasing the interval of integration
2009 Jan 24
2
Different values for double integral
Dear R useRs,
i have the function f1(x, y, z) which i want to integrate for x and y.
On the one hand i do this by first integrating for x and then for y, on
the other hand i do this the other way round and i wondering why i
doesn't get the same result each way?
z <- c(80, 20, 40, 30)
"f1" <- function(x, y, z) {dgamma(cumsum(z)[-length(z)], shape=x, rate=y)}
2009 Apr 22
2
integrate lgamma from 0 to Inf
Dear R users,
i try to integrate lgamma from 0 to Inf. But here i get the message "roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too.
## Stirlings approximation
lgammaApprox
2004 Mar 02
2
Problem with Integrate
The background: I'm trying to fit a Poisson-lognormal distrbutuion to
some data. This is a way of modelling species abundances:
N ~ Pois(lam)
log(lam) ~ N(mu, sigma2)
The number of individuals are Poisson distributed with an abundance
drawn from a log-normal distrbution.
To fit this to data, I need to integrate out lam. In principle, I can
do it this way:
PLN1 <- function(lam, Count,
2013 Jan 17
1
Fwd: Re: Inconsisten declaration of ssh_aes_ctr_iv()
Oops, I meant to CC the list on this.
--
Iain
----- Forwarded message from Iain Morgan <Iain.Morgan at nasa.gov> -----
Date: Thu, 17 Jan 2013 14:51:01 -0800
From: Iain Morgan <Iain.Morgan at nasa.gov>
To: Damien Miller <djm at mindrot.org>
Subject: Re: Inconsisten declaration of ssh_aes_ctr_iv()
On Wed, Jan 16, 2013 at 21:26:39 -0600, Damien Miller wrote:
> On Mon, 14 Jan
2018 Mar 23
1
Integrate erros on certain functions
In the help for ?integrate:
>When integrating over infinite intervals do so explicitly, rather than
just using a large number as the endpoint. This increases the chance of a
correct answer ? any function whose integral over an infinite interval is
finite must be near zero for most of that interval.
I understand that and there are examples such as:
## a slowly-convergent integral
integrand
2012 Jul 24
4
Integrate(dnorm) with different mean and standard deviation help
I'm trying to provide different parameters to the integrate function for various probability functions. I'm using dnorm as the simplest example here. For instance integrate(dnorm, -1.96, 1.96) produces the correct answer for a normal distribution with mean 0 and standard deviation 1. I've tried two ways to use mean=2.0 and standard deviation 1, but with no luck. The examples follow.
2012 Mar 23
3
R numerical integration
Hi all,
Is there any other packages to do numerical integration other than the
default 'integrate'?
Basically, I am integrating:
integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
The integration is ok provided sigma is >0.
However, when mu=-1.645074 and sigma=17535.26
It stopped working. On the other hand, Maple gives me a value of
0.5005299403.
It is an
2011 Jun 06
2
Taking Integral and Optimization using Integrate, Optim and maxNR
Dear All, Hello!
I have some questoins in R programming as follows:
Question 1- How to take the integral of this function with respect to y, such that x would appear in the output after taking integral.
f(x,y)=(0.1766*exp(-exp(y+lnx))*-exp(y+lnx))/(1-exp(-exp(y+lnx))) y in (-6.907,-1.246)
It is doable in maple but not in R. At least I could not find the way.
p.s: result from maple is:
2007 Mar 08
2
integrate function (PR#9557)
Full_Name: Bert De Boeck
Version: R 2.2.0
OS: Windows
Submission from: (NULL) (157.193.193.152)
I think there is a bug when using integrate for integrating a function which is
0 in a whole sub-interval. For example:
#define uniform function
f<-function(x){ifelse(x<1,0,ifelse(x<3,1,0))}
#this is the correct integral
integrate(f,-10,10)
#here there is a problem
integrate(f,-50,50)
2008 Aug 26
2
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. The integration should be between 0 and 1 as it is a probability.
The function "integrate" works fine when the absolute value of theta is not too large. That is, the NEF-HS distribution is not too skewed. However, once the
2015 Apr 09
3
typo in R-exts.html section 6.9
In 'Writing R Extensions' section 6.9 there is the paragraph
There are interfaces (defined in header R_ext/Applic.h) for definite and
for indefinite integrals. ?Indefinite? means that at least one of the
integration boundaries is not finite.
An indefinite integral usually means an antiderivative, not an integral
over an infinite spread. Should that first sentence end with 'for
2007 Aug 23
1
nls() and numerical integration (e.g. integrate()) working together?
Dear List-Members,
since 3 weeks I have been heavily working on reproducing the results of an
economic paper. The method there uses the numerical solution of an integral
within nonlinear least squares. Within the integrand there is also some
parameter to estimate. Is that in the end possible to implement in R
[Originally it was done in GAUSS]? I'm nearly into giving up.
I constucted an
2005 Jul 28
3
using integrate with optimize nested in the integration
Hi guys
im having a problem getting R to numerically integrate for some function,
say f(bhat)*optimize(G(bhat)), over bhat. Where id like to integrate this over some finite range, so that here as we integrate over bhat optimize would return a different optimum.
For instance consider this simple example for which I cannot get R to return the desired result:
f <- function(bhat) exp(bhat)
g
2011 Jan 25
3
Integration of two lines
Hello,
I need to integrate the absolute difference between two lines measured
on different points.
# For example :
x <- seq(0, 1, 1/100)
f_x <- runif(101) + x
y <- seq(0, 1, 1/23)
f_y <- runif(24) + (1 - y)
plot(x, f_x, type="l")
lines(y, f_y)
Then I would like to compute Integral( | f_x - f_y | )dx.
(This is not the same as | Integral(f_x)dx - Integral(f_y)dx |.)
2005 Jul 17
1
Strange problems with lattice plots
Dear r-help,
I need to draw some lattice plots and have stuck in strange problems.
I have a data frame of 405 rows:
> str(dframe)
`data.frame': 405 obs. of 4 variables:
$ year : num 1990 1990 1990 1990 1990 1990 1990 1990 1990 1990 ...
$ month: num 1 2 3 4 5 6 7 8 9 10 ...
$ V_A2 : num NA NA NA NA NA ...
$ V_A3 : num NA NA NA NA NA ...
Variable month changes from 1 to 27
2011 Mar 04
3
integrate a fuction
I'm having a function of the form
1> f<-function(x){
1+
1+ return(x^p)
1+
1+ }
,and I would like to integrate it with respect to x, where p should be any
constant.
One way would be to set a value for p globally and then call integrate
function:
p=2
integrate(f, lower = -1, upper = 1)
However, I would like to use 'integrate' inside a function, so I could call
it passing
2019 Apr 12
2
integrate over an infinite region produces wrong results depending on scaling
Dear all,
This is the first time I am posting to the r-devel list. On
StackOverflow, they suggested that the strange behaviour of integrate()
was more bug-like. I am providing a short version of the question (full
one with plots: https://stackoverflow.com/q/55639401).
Suppose one wants integrate a function that is just a product of two
density functions (like gamma). The support of the
2007 May 24
3
Problem with numerical integration and optimization with BFGS
Hi R users,
I have a couple of questions about some problems that I am facing with
regard to numerical integration and optimization of likelihood
functions. Let me provide a little background information: I am trying
to do maximum likelihood estimation of an econometric model that I have
developed recently. I estimate the parameters of the model using the
monthly US unemployment rate series
2010 Dec 02
4
Integral of PDF
The integral of any probability density from -Inf to Inf should equal 1, correct? I don't understand last result below.
> integrate(function(x) dnorm(x, 0,1), -Inf, Inf)
1 with absolute error < 9.4e-05
> integrate(function(x) dnorm(x, 100,10), -Inf, Inf)
1 with absolute error < 0.00012
> integrate(function(x) dnorm(x, 500,50), -Inf, Inf)
8.410947e-11 with absolute error <