1

I have the following code in MATLAB, which I believe calculates the probability of a certain point (p) in the normal distribution. I know sigma (variance) and mu (mean) based on calculations.

f = (1/sqrt(2 * pi * (sigma(x, y))^2)) * exp(-((p - mu(x, y))^2)/(2 * (sigma(x, y))^2));

if f >= P
    cloud = false;
else
    cloud = true;
end

My question is this, if p = 0.1 and P = 0.9, will my result be that there is at least a 90% chance that p will be less than or equal to 0.1?

This is for cloud cover, so I am looking at whether there will be at least a 90% chance that cloud cover will be 10% or less.

  • The function is [probability density function](https://stats.stackexchange.com/questions/4220/can-a-probability-distribution-value-exceeding-1-be-ok/4223#4223) not a cumulative distribution function so it does not answer the question you ask. – Tim Jun 01 '17 at 13:15
  • Suggestion on a function to use? – user1187621 Jun 01 '17 at 13:17
  • 1
    You are looking for [quantile function](https://stats.stackexchange.com/questions/212813/help-me-understand-the-quantile-inverse-cdf-function/212828#212828). But from your description it is not clear if what you are trying to do has any sense (e.g. normal distribution does not seem to be good choice for cloud cover -- how could it possibly be negative? and mu and sigma are some kind of functions of some x and y -- you probably should use some kind of multivariate model etc.). – Tim Jun 01 '17 at 13:26
  • I apologize. I have historical cloud cover data that I have averaged and found the variance of. The x and y specify a point in my MATLAB data, and can be ignored. Again, my apologies for not explaining. – user1187621 Jun 01 '17 at 13:38

1 Answers1

0

If you have good reasons to think that your variable follows this/a normal distribution (which is not the case according to Tim), what about:

defining your PDF as

density_func = @(value) (1/sqrt(2*pi*sigma^2))*exp(-0.5*((value - mu)^2)/sigma^2);

And then computing the area under the curve between $-\infty$ and value=p to get the cumulative probability you want, as follows

cumdensities_func = @(value) quad(density_func,-inf,value);
cumdensities = cumdensities_func(p)

where cumdensities is the probability that data generated by this -- $\mathcal{N}(\mu,\sigma^2)$ -- gaussian process will be less than or equal to p.

keepAlive
  • 849
  • 1
  • 7
  • 17