How can i generate probabilities from a dataset?

7 views (last 30 days)
evi
evi on 13 Jun 2014
Edited: José-Luis on 13 Jun 2014
good evening to all
I have a data set and i want to generate probabilities for each of these observations . I have generated a pdf (and a cdf) through the kernel smoother, since i didn't want to suppose a specific kind of pdf, but i still don't have probabilities for my data, i just have the figures. What i want is a way to generate probabilities for my data (i have 2 columns in excel). I already created two samlpes from these data.
thanks a lot

Answers (1)

Star Strider
Star Strider on 13 Jun 2014
I do not know what your data are or what you want to do with them, but I assume you want independent probability estimates for the elements in each column, with each column considered a separate variable. The ksdensity function will do this for you, if you tell it to calculate the probabilities for each of the points in your data set. The ‘f’ is the probability (taken from the pdf).
Example:
x = conv(rand(1,10),rand(1,10));
[f,xi] = ksdensity(x,x);
figure(1)
plot(xi,f, '*')
Does this do what you want?
  2 Comments
evi
evi on 13 Jun 2014
Thank you for your answer. I have two columns with stocks' returns and i need a probability for each observation to calculate the expected return in a specific way (not "mean") but i totally need two more columns with probability for each observation, columns of the same size as the two columns with returns, like 1-1 correspondence . E.g. a return i of 0.01 can be achieved with a probability p(i), this p i need.
José-Luis
José-Luis on 13 Jun 2014
Edited: José-Luis on 13 Jun 2014
I think there's an error in semantics somewhere. ksdensity will produce a kernel density estimate which is a continuous probability distribution. Therefore the probability for a discrete data value cannot be defined for that. You can get the probability for a given interval, but not for a particular data point.
If you want the discrete probability then you should use histc() or similar and calculate the densities for each discrete datum.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!