Why is the normal distribution line not appearing?

Why is the normal distribution line not appearing? I did succesfully with another data, but not this different data. Thank you.

hist(MSFT$msft_return,
col="red",
xlab="Return",
ylab="Frequency",
main="Return of MSFT")
rug(jitter(MSFT$msft_return))

x=MSFT$msft_return
h=hist(x, col = "red", xlab="Return", ylab = "Frequency")
xfit=seq(min(x), max(x), length=100)
yfit=dnorm(xfit, mean=mean(x), sd=sd(x))
yfit=yfit*diff(h$mids[1:2])*length(x)
lines(xfit, yfit, col="blue", lwd=2)

Quite possibly you need to set ylim and xlim to be sure the axes accommodate all the values.

1 Like

It is apparently. Thank you for the feedback!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.