[R] [FORGED] qqPlot vs qqcomp

mohsen hs mohsenhs82 at yahoo.com
Tue Jan 26 09:33:56 CET 2016


Hi Peter and Rolf,
Hope you are doing well and thanks for your time earlierlast year. I have started working on the data again and used the first ideathat Peter proposed:

Take log of your data andcompare with normal distr.

Hence, I tried the following code:

library(EnvStats); library(fitdistrplus)

mydata <- exp(rnorm(100))

 ct=0

 arr = NULL

for(i in 0:100)

{

  arr[ct]=0

  ct=ct+1

}

arr[98]=1

arr[99]=1

p=mydata;

lp=log(p)

fitln2 <- fitdist(lp, "norm")

dev.new();qqcomp(fitln2)

 dev.new();qqPlotCensored(lp, as.logical(arr),distribution = "norm",censoring.side = "right",add.line = TRUE, main = "")

 #The above twocommands generate same plots, but they are different with the following commands:

 fitln=fitdist(p,"lnorm")

dev.new();qqcomp(fitln)



Now, I was wondering if you could kindly give me some advicewhy I can not get a similar plot to qqcomp from qqPlotCensored and how I canget a plot similar to qqcomp from qqPlotCensored?


 
Another question that I appreciate if you could kindly replyis as follows:

I get the lowest AIC from the following commands, but can I claimthat my data follow the lnorm distribution since I am not sure whether I am usinglnorm or norm distribution by the following command?


 
 lp=log(p)

fitln2 <- fitdist(lp, "norm")

dev.new();qqcomp(fitln2)



Thanks a lot for considering my questions and please forgive me if my questions might be look simple.
Many thanksMohsen 

    On Friday, December 25, 2015 1:45 AM, peter dalgaard <pdalgd at gmail.com> wrote:
 

 Two ideas:

a: Take log of your data and compare with normal distr.

b: Use log="xy" as a graphical parameter.

Otherwise, you're on your own.

-pd

> On 24 Dec 2015, at 10:03 , mohsen hs <mohsenhs82 at yahoo.com> wrote:
> 
> Hi Peter,
> 
> Thanks once again for your kind reply.
> 
> One quick question, could you please guide me and let me know how I can get the similar qq plot(log-log scale) that I get from qqcomp, from qqPlotCensored function(It is similar to qqPlot, and available in EnvStats  http://www.inside-r.org/node/218933 ).
> 
> Thanks a lot.
> 
> Cheers
> Mohsen
> 
> 
>  
> MHS
> 
> 
> On Wednesday, December 23, 2015 6:52 PM, mohsen hs <mohsenhs82 at yahoo.com> wrote:
> 
> 
> Hi Peter and Rolf
> 
> Thank you for your time and replying me. It makes sense now. I sincerely appreciate that.
> 
> Cheers
> Mohsen
>  
> 
> 
> 
> On Tuesday, December 22, 2015 10:08 PM, peter dalgaard <pdalgd at gmail.com> wrote:
> 
> 
> 
> > On 22 Dec 2015, at 07:30 , mohsen hs via R-help <r-help at r-project.org> wrote:
> > 
> > The above command gives me a differentplot. I am not sure what part I am doing wrong. I appreciate your time forconsidering my request and your feedback is highly appreciated. Please find the plots attached. The right one is from qqcomp and the left one is from qqPlot. Titles might be incorrect.
> 
> They never arrived, but your data weren't actually needed. The crucial missing information was the packages used. This will do:
> 
> > library(EnvStats); library(fitdistrplus)
> > serving <- exp(rnorm(100))
> > qqPlot ( serving, dist ="lnorm", estimate.params = TRUE, add.line = TRUE)
> 
> > 
> > fitln <- fitdist(serving,"lnorm",method="mle")
> > qqcomp(fitln)
> 
> 
> The difference is quite clearly that qqPlot is doing a QQ-plot of log(serving) vs. normal quantiles, whereas qqcomp plots serving itself against lognormal quantiles. So the former is pretty much equal to the latter on a log-log scale.
> 
> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com










  
	[[alternative HTML version deleted]]



More information about the R-help mailing list