# R - Same Density but different QQ-Plot?

I have data variable corresponding to quotation amount and I want to find which statistic law this variable follow if there is one.

It seems that the log-normal law is a good candidate regarding the density of the distribution but the QQ-Plot does not match at all.

How can this be possible since both methods are supposed to test whether my data are fitting the log-normal law ? I don't have a lot of experience with those tools yet...

For information, I used the R-package fitdistrplus :

>f <- fitdist(amount,"lnorm")
>
>f
#Fitting of the distribution ' lnorm ' by maximum likelihood Parameters:
#estimate  Std. Error
#meanlog 8.610446 0.008045692
#sdlog   0.931252 0.005689134
>
>plotdist(amount,"lnorm",para=list(meanlog=f$estimate[1],sdlog=f$estimate[2]))


You can find below the histogram drawn with the Freedman–Diaconis method for more precision :

You can find here a related question

• The title premise is false -- it can't be lognormal; there's distinct discreteness; beside that the data seem to be drawn from a shorter tailed distribution than that lognormal, though only the Q-Q plot makes it really obvious (if you know what you're looking for you can see it in the ECDF and if the P-P plot points didn't obscure the line you might be able to make it out there. You may find it easier to see in the density and perhaps ECDF if you compare the logs of the data with the corresponding normal. ... Edit: Ah, I see you do that in your answer. The lack of fit to the normal seems clear – Glen_b Sep 2 '15 at 17:38
• I'd advise using smaller points and plotting the line in a contrasting color. The fact that it's clear that the data are not drawn from a lognormal (nor the log-data from a normal, naturally) may be of little consequence depending on what you're trying to do. Why do you need to identify a distribution? – Glen_b Sep 2 '15 at 17:49
• I am very new to deep statistical analysis. My ultimate purpose is to analyse quotation amounts on a website based on the weather (temperatures, humidity, atmospheric pressure). For that purpose I decided that the first step was to try to completely understand my data, especially the variable that I want to explain (amount). Do you think that even for the variable logamount the normality cannot be assumed in my answer ? – Yohan Obadia Sep 3 '15 at 10:02
• It might be relevant to note that amount is a variable not really continuous because on the website you can only use a cursor to define the amount you want and even if it is possible to indicate precise integers (but no decimals), it is rarely the case. People generaly pick round numbers. – Yohan Obadia Sep 3 '15 at 10:13
• While it's clear that the log-data are not drawn from a normal distribution (just as it's clear the original data are not lognormal), that doesn't mean you can't fruitfully use a procedure that assumes it; that depends on a variety of things -- the manner and extent of deviation from the asusmption, the sensitivity of the various properties of what you're doing to such deviation, and your ability to tolerate those properties being different from the nominal ones. In short, I don't have a good basis to conclude that you could (nor shouldn't) assume normality for the log-values. – Glen_b Sep 3 '15 at 10:44

This answer does not provide a direct answer to the question why the CDF is ok and not the QQ-Plot but at least it seems to have fixed my problem except for the tails.

I used a Box-Cox transformation and finded that the lamdba that the MLE was founded for a lambda=0 which leads to a log transformation :

boxcox_vector(amount)

#This function allows to use the boxcox funtion that is originally meant
#only for statistical models and not for analyzing a single vector.


Original idea here

boxcox_vector <- function(vector){
out <- boxcox(vector~1)
return(out)
}


f <- fitdist(logamount,"norm")
plotdist(logamount,"norm",para=list(mean=f$estimate[1],sd=f$estimate[2]))


I hope this can be of some help to others. I am a real rookie in statistics and as such there is probably a lot to say about my methods and results. Feel free to comment/correct my answer if need be.