Normal probability plot

I have a dataframe that contains SalePrice and I’m trying to plot the normal distribution and the normal probability plot.

To plot the distribution I’m using Plots jl and StatsPlot and doing something like

histogram(train.SalePrice, normalize=true)
density!(train.SalePrice)

getting something like
image

I’m trying to plot also the normal distribution over that plot. Using python and seaborn you can simply do that:
sns.distplot(df_train['SalePrice'], fit=norm);

image

I’m also trying to plot the probability plot. In python i did
res = stats.probplot(df_train['SalePrice'], plot=plt)
getting something like this

image

So, is there a way in Julia to obtain the same thing?
Thanks.

Have a look at qqplot in StatsPlots.jl
https://github.com/JuliaPlots/StatsPlots.jl#quantile-quantile-plots

1 Like

Thanks qqplot is exactly what i was looking for.

Any way to plot the normal distribution over the normalized histogram? Thanks.

I’m no sure if Plots.jl allows you to determine the z-order of lines and areas, but you can always make the histogram semi transparent with the alpha keyword

I misunderstood the question, you can

using Distributions
plot(Normal(mu, sigma))

To plot a distribution

I’m trying something like that

histogram(train.SalePrice, normalize=true)
density!(train.SalePrice)
plot!(Normal(mean(train.SalePrice), var(train.SalePrice)))

I get this

image

But it doesn’t seems right. I’m expecting this result

image

Also tried using only mean without the variance and get this:

image

You need to use std instead of var.

2 Likes

Indeed, in standard notation \sigma (the standard-deviation sigma) is the square-root of the variance you computed.

2 Likes