probability-distribution

Matlab cannot compute an infinite integral?

走远了吗. 提交于 2020-01-23 17:38:47
问题 I am studying Stochastic calculus, and occasionally we need to compute an integral (from -infinity to +infinity) for some complex distribution. In this case, it was with the answer on the right. This is the code I put into Matlab (and I have the symbolic math toolbox), which Matlab simply cannot process: >> syms x t >> f = exp(1+2*x)*(1/((2*pi*t)^0.5))*exp(-(x^2)/(2*t)) >> int(f,-inf,inf) ans = -((2^(1/2)*pi^(1/2)*exp(2*t + 1)*limit(erf((2^(1/2)*((x*1i)/t - 2i))/(2*(-1/t)^(1/2))), x, -Inf)*1i

R: Convergence problems with numerical integration

ぐ巨炮叔叔 提交于 2020-01-06 06:39:11
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

R: Convergence problems with numerical integration

戏子无情 提交于 2020-01-06 06:39:06
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

R: Convergence problems with numerical integration

烂漫一生 提交于 2020-01-06 06:38:51
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

I need to run a fair dice simulation multiple times

时光怂恿深爱的人放手 提交于 2019-12-25 18:31:21
问题 I have a program that simulates a dice roll 100 times. I need to know how to run this program 10^5 times, I think it is something to do with numeric. set.seed(123) x <- sample(1:6, size=100, replace = TRUE) hist(x, main="10^6 fair rolls", xlab = "Dice Result", ylab = "Probability", xlim=c(0.5,6.5), breaks=-1:100+.5, prob=TRUE ) 回答1: As suggested by @markus, you can use replicate : set.seed(123) nTime <- 10^5 x <- replicate(nTime, sample(1:6, size=100, replace = TRUE)) hist(x, main="10^6 fair

PDF and CDF for Biased die using Matlab with Central Limit Theorem

末鹿安然 提交于 2019-12-24 18:47:37
问题 I am trying to plot the PDF and CDF for a biased die roll for 10^4 samples using Central Limit Theorem.(CLT) The die is biased or unfair where even sides are twice as likely as odd sides. Here is the diefaces = [1,3,2,4,6,2].What can I use in Matlab to find probability of an odd number in this case with CLT where Sn = X1 + X2 + ... + Xn , n = 40. Here is what I have tried so far. The part that I am struggling with is passing the samples which in this case is 10^4 and n=40. Appreciate any help

Matlab: generate random numbers from custom made probability density function

天涯浪子 提交于 2019-12-19 11:38:26
问题 I have a dataset with 3-hourly precipitation amounts for the month of January in the period 1977-1983 (see attachment). However, I want to generate precipitation data for the period 1984-1990 based upon these data. Therefore, I was wondering if it would be possible to create a custom made probability density function of the precipitation amounts (1977-1983) and from this, generate random numbers (precipitation data) for the desired period (1984-1990). Is this possible in Matlab and could

How dnorm works?

北慕城南 提交于 2019-12-04 23:21:54
问题 I am very new to Statistics and R. Maybe this is a very trivial question, but I don't really understand how this works. Suppose I use dnorm(5, 0, 2.5) . What does that mean? I saw some resources where they told that this function computes the height of the point in the density curve. Now again I read that the exact probability of a number is 0 in continuous distribution. So, my question is if I can find out the height or probability of a certain value, then how come it is 0? I know I have

How to generate random numbers with predefined probability distribution?

孤街醉人 提交于 2019-12-04 12:59:33
问题 I would like to implement a function in python (using numpy ) that takes a mathematical function (for ex. p(x) = e^(-x) like below) as input and generates random numbers, that are distributed according to that mathematical-function's probability distribution. And I need to plot them, so we can see the distribution. I need actually exactly a random number generator function for exactly the following 2 mathematical functions as input, but if it could take other functions, why not: 1) p(x) = e^(

How dnorm works?

泄露秘密 提交于 2019-12-03 15:01:37
I am very new to Statistics and R. Maybe this is a very trivial question, but I don't really understand how this works. Suppose I use dnorm(5, 0, 2.5) . What does that mean? I saw some resources where they told that this function computes the height of the point in the density curve. Now again I read that the exact probability of a number is 0 in continuous distribution. So, my question is if I can find out the height or probability of a certain value, then how come it is 0? I know I have mixed up some concepts. But I'm unable to find where I'm wrong. It will be great if you spare your time to