[R] Probability distribution of fitted gaussian distribution.

Jacob Varughese zdjacob at gmail.com
Sat Jan 3 18:27:44 CET 2015


I have a discrete set of data on the returns for 3 indices with 206 data
points. Since the number of points is less it doesnt exact look like a
gaussian distribution.

I wanted to fit the data to a gaussian distribution and have used the
fitdist function and have gotten the plots and the mean and sd estimates
for the gaussian that fits my data.

What I then want to do is to get a U=F(x) where U is the uniform variable
corresponding to the CDF function applied on the fitted theoritical CDF
curve. How can I get that?

Equivalent data that I find in matlab. Here the ksdensity gives an array of
f and xi values and I could use the f values for my usage. But I am trying
to work it out in R. The steps that I am going through in R are below. I
have also attached the input sheet that I am using for the indices. Sorry
in advance, case its a dumb one.

Estimate Density

Generate a sample data set from a mixture of two normal distributions.

rng default  % for reproducibility
x = [randn(30,1); 5+randn(30,1)];

Plot the estimated density.

[f,xi] = ksdensity(x);

Steps that I am following.

# Reading and finding the returns for 3 indices.

# Using fitdist to fit a gaussian distribution onto the discrete empirical
data I have.

> fittedNormal[]
        mean           sd
-0.002035951  0.028654032

[1] "mle"

       mean          sd
0.001996421 0.001403953


http://cran.r-project.org/web/packages/fitdistrplus/fitdistrplus.pdf  ~
 Page 15

*Jacob Varughese*

More information about the R-help mailing list