1,275 questions
0
votes
1
answer
53
views
Cutover point between two CDF implementations
My goal is to implement a CDF (cumulative distribution function) for the Standard Normal Distribution and to do so with the best possible numeric accuracy.
This is my starting point: (1 + erf(x / sqrt(...
0
votes
1
answer
108
views
in R, How to test a dataset, then remove a point, and repeat the process for grouped data?
I am investigating profiles of downwelling light within the ocean, and attempting the 'dark signal identification' process in https://doi.org/10.1175/JTECH-D-15-0193.1.
I have data that is formatted ...
0
votes
0
answers
39
views
Interest rate EURIBOR-Switch regime monte carlo
Question for Expert Forum:
I am working on a Regime-Switching Monte Carlo Simulation for EURIBOR interest rates, where I
Estimate separate ARIMA models for three identified regimes (Hiking, Cutting, ...
0
votes
0
answers
81
views
KL divergence between Normal Inverse Gaussian distributions in JAX/ TF
I want to write a Python script which approximates the KL divergence between NIG distributions, as parameterized in tensorflow. To do so, I want to use the chain rule for KL divergences and need to ...
0
votes
0
answers
56
views
Normality Issue with `gam.check()` after adding Random Effect
I am trying to run a GAM that includes 8 input variables (see code below). I first ran the model without accounting for any random effect and the gam.check() appeared to be a good fit. After I add the ...
0
votes
1
answer
280
views
Any Difference between `torch.distributions.normal.Normal` v.s. `torch.distributions.Normal`
I only see torch.distributions.normal.Normal in the official documents but never see torch.distributions.Normal. However, I sometimes see people use torch.distributions.Normal in their codes in Github....
0
votes
1
answer
165
views
Implement normal distribution and inverse normal distribution in Oracle
I want to have this excel formula in Oracle:
=((0.05*NORM.S.DIST((1/(SQRT(1-0.3))*NORM.S.INV(0.3)+(SQRT(0.04/(1-0.04))*NORM.S.INV(0.999))),TRUE())-0.09*0.3))*12.5
I have found dbms_random.normal in ...
0
votes
2
answers
319
views
How to generate random numbers that roughly follow a normal distribution that also add up to a specific total?
I'm trying to generate a random set of numbers that add up to a specific total, and a specific maximum value that the numbers can reach.
However each approach I seem to have come across have some flaw ...
0
votes
1
answer
302
views
Conditional Multivariate Gaussian with scipy
For a multi-variate Gaussian, it is straight-forward to compute the CDF or PDF given a point. rv = scipy.stats.multivariate_normal(mean, cov) and then rv.pdf(point) or rv.cdf(upper)
But I have values ...
1
vote
1
answer
76
views
The leading minor of order 14 is not positive (rmvnorm)
I have a 30 by 30 covariance matrix that is symmetric (passes with both the isSymmetric function as well as is.symmetric.matrix from matrixcalc library). However, I can't sample from it using rmvnorm()...
0
votes
1
answer
106
views
How to check wether two mean values are significantly different?
I have two distributions with a size of ~120 and ~86.000 elements. I would like to check wether the mean value of the two distributions are significantly different.
I found, that I can use a Welch’s t-...
0
votes
0
answers
166
views
Issues with optim function: Parameters Stuck Around Initial Values
I am experiencing issues with the optim function in R, where it seems to get stuck near the initial parameter values and does not explore the parameter space effectively. Below is a simplified version ...
4
votes
1
answer
308
views
Multivariate normal distribution using python scipy stats and integrate nquad
Let
be independent normal random variables with means
and unit variances, i.e.
I would like to compute the probability
Is there any easy way to compute the above probability using scipy.stats....
0
votes
1
answer
64
views
Having trouble determining if my data is normally distributed or not using QQ-plot in R
I'm having trouble interpreting my QQ-plot from the data attached. Shapiro-Wilk test p-value = 0.14 which I know means the distribution does not meaningfully stray from a normal one. Can anyone ...
3
votes
1
answer
78
views
How to randomly sample from a skewed gaussian distribution in boost c++?
I am trying to sample a skewed gaussian distribution with the Mersenne Twister pseudo-random generator. I am using boost as the skewed gaussian distribution is not implemented in in C++ standard.
The ...
2
votes
1
answer
160
views
Random perturbation of a value in MATLAB
Let's say I have a value 100 and I want to perturb this value randomly by 1% based on a normal distribution. How could I do this in MATLAB? I seem to have some confusion with randn etc.
I have used ...
2
votes
1
answer
145
views
Computing multivariate normal integral over box region in SciPy
I am trying to evaluate the multivariate normal distribution to get the probability that 1 < z1 < 2.178 and 2.178 < z2 < inf. The mean of the distribution is zero, all variances are 1, and ...
1
vote
1
answer
399
views
fit bimodal skewed gaussian
I have some data that I am trying to fit with a bimodal skewed gaussian. I started with a standadard bimodal gaussian and the data is just too skew. I also want to be able to extract the underlying ...
0
votes
1
answer
427
views
Why does my Monte Carlo simulation not give a normal distribution?
Why does my python Monte Carlo simulation not produce a normal distribution?
import random
import matplotlib.pyplot as pyplot
import numpy
P = 0.1
TR = 1_000
l = []
for _ in range(TR):
tosses = ...
1
vote
0
answers
78
views
Adding Tails to Curve with a set Intercept, Area, and Weighted Integral
I have a roughly normal distribution curve with the tails chopped off. It looks like this:
I am trying to add tails to this curve (and others like it), but they have to meet some specific conditions
...
1
vote
1
answer
89
views
How do you generate random variables according to a given continuous probability density function?
I'm trying to generate random variables according to three different probability density functions. Two of the functions are scaled normal distributions, µ = 260/3, σ = 100/3, scaled by 1.53666351546 ...
2
votes
1
answer
291
views
In Distributions.jl package for Julia, how to define MvNormal distributions with the Cholesky matrix?
I am writing some code that transforms multi-variate distributions by operating mostly on the cholesky factor of the covariance matrix. Suppose I have
using Distributions
g1 = MvNormal([1,2], [2 1; 1 ...
4
votes
1
answer
122
views
Data is normally distributed, but ks test return a statistic of 1.0
I have an age variable. When I plotted it using the kde & qq-plot, the distribution seemed normal; however, when I performed the ks-test, the test statistics = 1.0, p = 0.0.
Can someone please ...
2
votes
1
answer
184
views
Correct way to combine Normal distributions in Julia with Distributions.jl
I have two multivariate normal distributions like such:
using Distributions, LinearAlgebra
g1 = MvNormal([1,2], [2 1; 1 2])
A = [3 1; 1 3]
B = [[A [0;0]]; transpose([0,0,1])]
g2 = MvNormal([1,2,3], B)
...
0
votes
0
answers
180
views
Getting Parameters of fitted pareto and normal distributions
I want to fit a normal and a pareto distribution to some data I collected. I will insert the codes for all three types of fitting below. You will notice that they are quite similar, as the concept of ...
1
vote
1
answer
63
views
Why does integrating scipy.multivariate_normal give incorrect probability?
I'm trying to integrate an independent bivariate normal distribution over a square region. The numerical integration does not match a Monte Carlo simulation. What's going wrong here?
import numpy as ...
0
votes
3
answers
1k
views
Generating a normally distributed random variable that has range [1, 3] in R
I want to generate a normally distributed random variable that has range [1, 3].
Specifically, I tried the following R code:
x1 <- runif(100, 1, 2)
x2 <- rnorm(100, 0, 0.3)
V <- 1 + x1 + x2
...
0
votes
0
answers
47
views
Hypothesis testing - Newbie blockers
Brief : I'm from manufacturing industry, a processing machine in our production line used to do pressing, polishing and QA in one line. Now we have a new machine that will perform these separately at ...
1
vote
0
answers
365
views
pmvnorm function's arguments in R
I was trying to compute the cumulative distribution function of a bivariate Normal random variable by the function pmvnorm from mvtnorm package.
I don't understand well all the arguments of this ...
0
votes
1
answer
789
views
Truncated Normal MLE
I want to do a Maximum Likelihood estimation for a truncated normal. First I generate data with two simple Equations X_1 = X_0 + E_1 and X_2 = X_0 + E_2 and truncate them depending on x_1 > x_0. ...
0
votes
1
answer
178
views
function in normal distribution in Python
How to write multiplication function in normal distribution in Python?
I have an error in my code which is as follows, I want to fix this error.
TypeError:unsupported operand type(s) for *: 'Add' and &...
2
votes
1
answer
737
views
Scaling of a Standard Normal Distribution
I have a question that is closely related to this one:
Normed histogram y-axis larger than 1
The solution of the above thread was to scale the dimensions of the axis properly.
However, that solution ...
1
vote
1
answer
77
views
Equivalent integrals not giving same numerical result with single and double integration
I have the following equivalent integrals involving the pdf and cdf of a standard normal distribution, denoted by $\phi(x)$ and $\Phi(x)$, respectively. For background, the integrals represent the ...
1
vote
2
answers
311
views
How to simulate from Gaussian trivariate distribution when X and Y are given?
Is there any easy python package solution for following problem?
I have got 3 variables, lets say they share trivariate normal distribution - so we know means and covariance matrix. Is there any ...
1
vote
1
answer
341
views
Pseudo-random number generator (LFSR), uniform to normal distribution using central-limit theorem not working correctly?
I'm having trouble generating normal random variables as part of a bigger project and need some help.
First of all, yes, I am aware of AWGN methods, Box-Muller etc and other better random number ...
2
votes
1
answer
442
views
Calculate probability that normal distribution sample is smallest in group polars python
I have a polars dataframe along the lines of:
df = pl.DataFrame(
{
"group": [1, 1, 1, 2, 2, 2, 2],
"mean": [25.5, 25.2, 24.9, 50.5, 55.1, 54.2, 60],
&...
0
votes
0
answers
73
views
How to reduce the size of only center part to normal distribution?
This is follow up question for solving my previous question.
normal distributed probability for corner of path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
gridPath = "...
0
votes
1
answer
61
views
normal distributed probability for corner of path
I am working on assgining the high probability at the center of path and low at the edge of path.
This is img of my current result. However, the probability values are overlap at the corner.
import ...
2
votes
1
answer
361
views
Better Understanding Log-Normal with SciPy
I know that are plenty of questions about the log-normal in scipy as this, this, this, and this But I still have doubts.
I'm trying to reproduce this example with SciPy, because I can understand the ...
1
vote
0
answers
48
views
Implement skewed normal distribution or a probability density fitting on the given data points, using Python?
This question has been posted on Mathematics StackExchange also.
Background
I have been trying to understand the cardiac function of an invertebrate animal. Based on the amplitude values, I plotted a ...
0
votes
1
answer
397
views
How to get the figure produced by the fitter package?
I am using the fitter package to fit many distributions simultaneously and visualize the outcome (documentation). However, I want access to the figure it produces.
from fitter import Fitter
f = Fitter(...
0
votes
1
answer
247
views
Fast way to discretize normal distribution in Python
I try to optimize this code, to discretize the cdf of the normal distribution (with n points, and delta beetween two points equal to 10**c):
import numpy as np
from scipy.stats import norm
def ...
0
votes
0
answers
48
views
Non-intuitive output from dmvnorm() within R mvtnorm package
I am trying dmvnorm() in the R package of mvtnorm with very similar matrices and resultant density are very different. More specifically,
library(mvtnorm)
library(magrittr)
train_mat2 <-
data....
0
votes
1
answer
136
views
R - Normal distribution with top 10% larger than specific value
I need to simulate a roughly normally distributed sample in R of size 500. 10%, i.e., 50 of the values should be larger than 50, the rest should be below 50 but still larger than 0.
I'm kind of stuck.....
0
votes
0
answers
167
views
How correct is this code to compute truncated lognormal distribution
I need to generate truncated lognormal distribution with minimum, maximum and size values of 0.0005, 0.01 and 1000 respectively. I have come up with the following code but not sure if it's correct and ...
0
votes
0
answers
35
views
For loop returning 0 for all iterations except the last one?
I have to generate 1000 values of M. for each value of M I have to generate 100 samples, on interval form that follow a distribution of N(M,1).
After that I separated each bound of an interval in two ...
2
votes
1
answer
129
views
Is there a way to create a 'truer' random outcome using a Gaussian normal distribution in C++?
I've scoured stack overflow for some descriptions, explanations, and snippets of the std::normal_distribution<> variable(mean, stddev) function, and have found one instance in particular, listed ...
1
vote
0
answers
191
views
How can I adjust my Gaussian Mixture Model (GMM)? (If it's wrong)
I have 1 dimensional data of clinical analysis such as leukocytes in blood. Regardless of the type of analysis they look more or less this way.
Histogram
Our guess (which is more than a guess) is that ...
-2
votes
1
answer
272
views
Why my fitting distribution in R is throwing out errors?
Here is a sample code where i am trying to fit multiple distribution. Can someone please look into the error and run the code to its entirety? Thanks
# Step 1: Load required libraries
library(ismev)
...
0
votes
0
answers
36
views
Getting java.lang.NoClassDefFoundError while using the NormalDistribution class of org.apache.math3
I am receiving the java.lang.NoClassDefFoundError error while using the NormalDistribution class of org.apache.math3
Attaching the statement where i am getting the error below.
org.apache.commons....