0

I am trying to overview if prices return have a so-called "fat-tailed" property. Unfortunately, my superposition of my gaussian curve and my return curve doesnot match.

To do that, I have a return vector:

data.ret

I carried the density, the mean, and the standard deviation of my vector:

data.sd <- sd(data.ret)
data.mean <- mean(data.ret)
data.density <- density(data.ret)

thus, I am able to find the gaussian distribution within my data.ret properties:

data.gauss <- dnorm(data.ret, data.mean, data.sd)

Then I plot my results:

plot(data.density, xlab="Return", ylab="", yaxt="n", main="Density of returns")
lines(data.ret , data.gauss, type="l",col="red",lwd=1,lty=3)

However, my gaussian curve does not look good, I suppose that I wrongly plot my gaussian distribution to fit with my return density: enter image description here

EDIT :

if I sort values of data.ret :

enter image description here

Thomas Th.
  • 111
  • 2
  • 2
  • 10
  • Agree that using lines with an unordered pair of values is the typical cause of such a jumbled plot. Suspect this is an often repeated question on SO. The "duplicate" was found with a search of "[r] plot lines mess" – IRTFM Jul 05 '18 at 16:09
  • I have just tried, but it does not look like anything gaussian : ( – Thomas Th. Jul 05 '18 at 16:11
  • 1
    Maybe the distribution is not Normal. Post the data if you want to ask a question that was different than "why is my plot a mess". I'll retract my close vote if there is data and a different question. – IRTFM Jul 05 '18 at 16:13
  • Even though that data.ret may not be gaussian, data.density is gaussian, since it is gaussian distribution with a mean and a standard deviation of data.ret – Thomas Th. Jul 05 '18 at 16:16
  • 1
    Thanks 李哲源 , it works perfectly – Thomas Th. Jul 05 '18 at 16:18
  • Sorry 42- for the misleading answer. – Thomas Th. Jul 05 '18 at 16:19

0 Answers0