Questions tagged [numerical-integration]

A class of algorithms to approximate definite integrals.

Filter by
Sorted by
Tagged with
0
votes
0answers
26 views

Check that a function is valid pdf [closed]

How can I check that an empirical-function $f(x)$ is a valid pdf? In particular I would like to know how to check (in R) the condition $\int_0^\infty f(x)dx = 1$, where I know the values of $f(x)$ but ...
0
votes
0answers
57 views

Integration to compute the absolute risk from cause specific cox models in R

I'm trying to get a sense of a formula and understand what I'm doing wrong when I'm implementing it for an example in R. The formula can be seen here: which is the formula to obtain the absolute risk ...
3
votes
1answer
30 views

Approximate Posterior Predictive Quantiles with Numerical Methods

I have a posterior function which is easy to approximate using numerical methods (the posterior has only 2 parameters, and is approximately Gaussian because of the large sample). However, I need to ...
1
vote
0answers
34 views

Conditional expectation of a normal variable given a lower bound [duplicate]

I saw the identity below but I'm not sure how to derive it. $$E[X\mid X>K] = \mu + \sigma \frac{\phi(z)}{\Phi(-z)} \text{ where } z = \frac{K-\mu} \sigma$$ I'm stuck at the following step: $$E[X\...
2
votes
1answer
39 views

Gompertz-Makeham Model Life Expectancy using Numerical Integration and Analytical Solution of Castellares et al. (2020)

I am trying to calculate life expectancies for the Gompertz-Makeham model, but can't replicate the results of the paper which gives the formulas. I use R to ...
3
votes
2answers
140 views

How to calculate Quasi-Monte Carlo integration error when sampling with Sobol's sequence?

My understanding is that QMC integration using random sampling will converge with $O(\frac{1}{\sqrt{n}})$, while using Sobol's sampling will converge with $O(\frac{(\log{n})^d}{n})$. However I'm ...
11
votes
5answers
699 views

Estimate the Euler–Mascheroni constant ($\gamma$) by Monte Carlo simulations

The Euler–Mascheroni constant is defined simply as the limiting difference between harmonic series and the natural logarithm. $$\gamma =\lim_{n\to \infty}\left(\sum _{k=1}^{n}{\frac {1}{k}}-\ln n\...
0
votes
0answers
44 views

Finding the marginal distribution of log-normal random variable whose mean is dependent on a Gaussian random variable

My goal is to be able to integrate out the observation error of $\hat{X}$ in the set-up below, in order to compute the likelihood of $\frac{X}{\hat{X}}$ over all possible values of $\hat{X}$ : The ...
0
votes
0answers
131 views

Deriving the risk of the Hodges-Le Cam estimator under squared-error loss

In order to better understand the behaviour of the Hodges-Le Cam estimator, $\tilde{\theta}_n$, I am trying to derive an expression for the risk $R_n(\tilde{\theta}_n, \theta)$ under squared error ...
1
vote
0answers
21 views

What is the expectation of a random variable satisfying some conditions?

How to find the expectation E[X.I(Y<x,X<x)], where X and Y are independent random variables with respective cumulative distribution functions F(.) and G(.) respectively. x is a positive value. ...
10
votes
1answer
292 views

Plain English explanation of Ito's integral?

I'm looking for a plain English explanation of Ito's integral. I don't need an exhaustive proof, derivation, etc. Just a simple ~this is effectively what it does and why it's better than a Riemann sum ...
2
votes
1answer
62 views

Numerically integrate gaussian pdf

Suppose I want to numerically integrate the function $g(\mathbf{x}) = \exp\bigg(-\frac12 \mathbf{x}^\mathsf{T}\mathbf{\Lambda} \mathbf{x}\,\bigg)$ to obtain the normalization constant $$\int_{\mathcal{...
2
votes
1answer
215 views

Kullback–Leibler divergence between multivariate t and the multivariate normal?

I want to calculate the Kullback–Leibler divergence between a multivariate $t$ distribution and a multivariate normal distribution, for different values of the degrees of freedom $\nu$. However, this ...
2
votes
0answers
67 views

Numerical integration of the exact distribution of the product of two random gaussian variables

I am trying to implement this function in R, which is equation (2) in this paper by Cui et al. (2016), which is the exact distribution of the product of two random gaussian variables. ...
1
vote
0answers
15 views

How do mixed models bypass the overflow inside the integration?

In a mixel model, when you try to maximize the likelihood, you have to integrate over the random effects. This means that you cannot take logs, since what would normally be a product of individual ...
1
vote
1answer
70 views

Computing the probability $P(\exists X\in\{X_1,\ldots, X_N\}:X>\text{max}\{Y_1,\ldots, Y_M\})$

I am trying to somewhat generalize a question, which has been asked in one way or another a several times here on StackExchange**. However, I have not managed to find an answer to the below problem. ...
1
vote
0answers
117 views

How to calculate confidence intervals for a generic (non-normal) pdf

In particular, this is a question about distributions with some skew and/or where the mean, median and mode might all be different. For any pdf, it's possible to find multiple different domains within ...
0
votes
1answer
341 views

Different estimates for mixed effects Logistic regression and pwrssUpdate Error message with binomial glmer

Hi this is my first post here. I reported an issue on Github and got valuable help from Dr. Bolker. However, I did some other analyses on the same data and got confused about some of the results. I ...
0
votes
0answers
27 views

Discrete correlation function (sample cross-covariance)

The continuous correlation function for the random variable $A(t)$ at a instant of time $t$ is given by \begin{equation} C_{AA}(\tau) =\frac{1}{T} \int_{0}^T d\bar{t} A(\bar{t})A(\bar{t}+\tau) \end{...
-3
votes
1answer
65 views

Positive or negatively bounded CDFs [closed]

If $X\in\mathbb{R}^n$ is a continuous random variable whose cumulative distribution function is ordinarily $$F_X(x) = \int_{-\infty}^{\infty} f_X(x) dx $$ what is the meaning of $$F_X(x) = \int_{0}^{\...
7
votes
1answer
205 views

Expressing a marginal probability using copulas

Please correct me if I am wrong and kindly provide me with the correct notations. I have two questions: We know that for the variables $(X,Y,Z)\in \mathbb{R}^3$, the marginal joint density $f(x,y)$ ...
1
vote
0answers
25 views

How to calculate Integral error from MCMC

I've recently started using Markov Chain Monte Carlo to calculate integrals, but I can't seem to find how to calculate the error for such an integral. In the standard case of importance sampling, the ...
0
votes
1answer
110 views

Computational Complexity of Multivariate Normal CDF

I'm going to post this here also as per user suggestions since I feel like the root cause of the issue is more maths related than code related. I'm working on a multivariate cross-entropy minimization ...
1
vote
1answer
64 views

Finding confidence interval for unimodal function equivalent to and comparable with standard deviation of normal

I'm trying to characterise an arbitrary, unimodal distribution in a way that is a) easily understandable (to a physics audience) and b) comparable with a normal distribution. My thinking goes like ...
3
votes
1answer
95 views

Numerical integration with measurement errors: what scheme to use?

I have an unknown 'smooth' function that is sampled at some $n$ equally spaced locations $x_i$ between $0$ and $1$, with some measurement values $f(x_i)=y_i$, but each has some Gaussian uncertainty ($(...
1
vote
1answer
111 views

Calculating variance of MC estimator of an integral

Let $$ f(x) = \sqrt{1-x^2}, \quad I = \int \limits_0^1 f(x) dx. $$ We consider the following estimator of I: $$ \hat{I}_n = \frac{1}{n} \sum \limits_{i=1}^n f(X_i), $$ where $X_1, X_2, ...$ are iid $...
0
votes
1answer
44 views

Why are my sampled values are non Gaussian?

I just have a quick question regarding Importance Sampling Monte Carlo integration. If I sample from some pdf, $p(x,y)$, to calculate an integral. I.e., $I = \int f(x,y) \ dx\ dy$ It can be ...
1
vote
1answer
230 views

Integration with accept reject sampling Monte Carlo

I've got a quick question with regards to accept-reject Monte Carlo integration that I can't solve. Suppose I want to integrate some function, $f(x,y)$, with samples of $x, y$ from $p(x,y)$. Now, ...
3
votes
1answer
74 views

How to calculate individual moments of a 2-dimensional distribution via Monte Carlo Integration

I've recently been using Monte Carlo integration to calculate a particular integrals which I can do fine but I've hit a problem where I can't calculate the individual moments of my distribution for ...
1
vote
1answer
18 views

how do you find the vector that minimizes [closed]

How do you find the vector that minimizes $\|A\mathbf{x}-\mathbf{b}\|_2^2$ ?
3
votes
0answers
139 views

Uncertainty propagation in ODEs

I want to see the effect of parameter uncertainty in the Euler method for ODEs. For a differential equation: $dx/dt=f$ with initial condition $x(0)=xo$ and a function $f$ (that has uncertain ...
0
votes
1answer
59 views

Relatively fast approximations to the marginal likelihood?

Let $\theta\in{\mathbb R}^d$ be a multidimensional parameters, where $d$ can be large (e.g. $d=100$ or more). What approximations can I use for the marginal likelihood: $$\int f(x\mid \theta)\pi(\...
0
votes
0answers
197 views

Minimize asymptotic variance of fintely many estimates

Let $(E,\mathcal E,\lambda)$ be a $\sigma$-finite measure space; $f:E\to[0,\infty)^3$ be a bounded function with integrable Euclidean norm on $(E,\mathcal E,\lambda)$ and $p:=\alpha_1f_1+\alpha_2f_2+\...
2
votes
0answers
21 views

Examples for integration estimator

suppose I'm interested in estimating $C=\int_{a}^{b}g(x)dx$, where $a$ and $b$ are known, and $g(x)=E(Y|X=x)$ is an unknown function of $x$. The data I have is $\{Y_{i},X_{i}\}_{i=1}^{n}$, then a ...
1
vote
0answers
107 views

Compute which of a finite number of integrals is minimal (not interested in the actual value of the integral)

Let $(E,\mathcal E,\lambda)$ be a $\sigma$-finite measure space; $f:E\to[0,\infty)^3$ be a bounded Bochner integrable function on $(E,\mathcal E,\lambda)$ and $p:=\alpha_1f_1+\alpha_2f_2+\alpha_3f_3$ ...
0
votes
0answers
23 views

multi-dim monte carlo integration -- some complicated integration

I want to integrate $$I= \int^1_0 \int^1_0 \frac{g(x,y)}{\int^1_0 h(x,y)\,dx} \,dx\,dy. $$ For now, I sampled $n \times n$ simulation samples from $unif[0,1]$ and estimate $$\hat{I} = n^{-2}\sum_{j}...
0
votes
0answers
120 views

Estimate $\lambda\frac{|f-\lambda f|^2}p$ without looping twice

Let $(E,\mathcal E,\lambda)$ be a measure space, $p$ be a probability density on $(E,\mathcal E,\lambda)$ and $f\in\mathcal L^2(\lambda)$. Say I want to estimate $$\int_{\{\:p\:>\:0\:\}}\frac{|f-\...
1
vote
0answers
70 views

Numerical Integration with respect to a mixture of Normals [closed]

I have a likelihood function that contains an integral of a latent parameter. I would like to numerically integrate it using Monte Carlo, as in, $L = \prod_{i=1}^N \int f(X, \tilde{\theta}; \beta) d ...
1
vote
0answers
49 views

Negative values returned from pmvnorm in R, for multivariate normal integration

I'm using pmvnorm to obtain triple integration for multivariate normal density function in R. The integration range is from negative infinity to finite numbers for all three variables. However, ...
2
votes
1answer
105 views

Nested Uniform Distributions in Monte Carlo Integration

In terms of importance sampling for numerical Monte Carlo integration we can proceed as follows: \begin{align} \int_{\Omega} p(\mathbf{x}) d\mathbf{x} &= \int_{\Omega} p(\mathbf{x}) \frac{q(\...
0
votes
0answers
21 views

Convergence of Diffusion Process Monte-Carlo

Let $X_t$ be a $d$-dimensional diffusion process initialized at $x \in \mathbb{R}^d$; given as the strong solution to the SDE $$ X_t = x + \int_0^t a(t,X_t)dt + \int_0^t b(t,X_t)dW_t; $$ where $a$ and ...
1
vote
0answers
53 views

How to approximate expectation and variance of an integral from a discrete Time series financial dataset?

I have discrete time series financial data, with time($u$), price($S$) and someVariable($q$) which looks something like this. ...
2
votes
2answers
139 views

Mean and variance of a non-standard pdf

I have tried to compute the variance and the mean for $\mu=0.5$ of the following PDF using Wolfram cloud but I failed $$ F(z,\mu,\sigma)=\frac{2 (z-\sigma )^2 \exp \left(-\frac{(z-\sigma )^2 \...
0
votes
1answer
222 views

is it a good idea to take the derivative or integral of some features and add them as new features in machine learning?

I'm learning how to do feature Engineering and come across some ideas in my head that's why I want to ask if I had some dataset with some features let's say 2 features and I have a timestamp column ...
0
votes
1answer
56 views

Expectation of continuous rv X^2

I ran the following algorithm to find the expected value of X^2 for a random variable X with pdf: exp(-abs(x)^3/3) This is what I did and my results: ...
7
votes
2answers
121 views

What is better in Monte Carlo integration: product of means or mean of products?

Let $X$ and $Y$ be two independent continuous random variables with pdfs $f_X$ and $f_Y$, respectively. Let $\varphi_1$ and $\varphi_2$ be two continuous functions from ${\mathbb R}$ to ${\mathbb R}$. ...
2
votes
0answers
21 views

Double Integral involving Beta Functions (about Pareto Distribution)?

I have tried evaluate $(m_i,m_j)$th product moment of $X_{(i)}$ and $X_{(j)}$ order statistics of Pareto Distribution, that is $E[X_{(i)},X_{(j)}]$, where $i\le j$ , $X_1,X_2,...,X_n$ i.i.d. from ...
13
votes
2answers
230 views

Why is pseudo-random sampling applicable for Monte Carlo integration, even though it does not satisfy the CLT requirements?

Assume we have a function $f\left(x\right)$ defined on $\left[0, 1\right]$ that we want to integrate and estimate the error using Monte Carlo method. We generate realizations of uniformly distributed ...
7
votes
4answers
748 views

Expectation of $\ln(1 + e^x)$, where $x$ is normally distributed

I need to evaluate the following integral: $$\int_{-\infty}^\infty\mathrm d x \exp\left(-\frac{(x-\mu)^2}{2\nu}\right) \ln(1+e^x)$$ where $\mu$ is a finite real number and $\nu > 0$. This is just ...
0
votes
1answer
122 views

Understanding Gauss-Hermite Weights

I routinely use Gauss-Hermite as a tool for approximating complex integrals. While I am proficient in its applications, I am not proficient in its development. I am working to understand the weights ...