# QQ plot for censored data (interval)

#### mohsenhs82

##### New Member
Dear All,

I am trying to fit my data to a distribution (say lognormal) in R with plotting QQ, and my data contains both right and left censoring. I highly appreciate that if you could provide me a sample, link, tutorial or anything. I also have access to SAS Educational.

Best regards
Mohsen

#### hlsmith

##### Less is more. Stay pure. Stay poor.
What do you want to do exactly?

#### mohsenhs82

##### New Member
Hi hlsmith

Please let me briefly explain the situation. We would like to model the traffic data and we collected the data from some devices. They were collected every 60 seconds (but not very accurately) and we distributed them by using uniform dist in 60 seconds randomly. We are interested to know what distribution model the data better.

Among all the distributions, lnorm fitted better and has the lowest AIC, BIC, but I can see a small tail both at the start and at the end (Values less than 2 seconds and values greater than 1000 sec). Hence, I would like to do the left censoring for val<2 and right for val>1000) and plot the QQ.

Looking forward to hearing from you.

Regards
M

#### hlsmith

##### Less is more. Stay pure. Stay poor.
So you have fitted a linear reg and the residuals look fine? Now you are trying to see if some transformations may increase fit.

#### mohsenhs82

##### New Member
No, I did not fit a linear regression. This is my code in R:
require(gglot2)
library(fitdistrplus)
library(MASS)
require(EnvStats)
z=rep(df$timenum,time=df$count)
fitln <- fitdist(z, "lnorm")
...
qqPlotCensored(z,as.logical(arr),distribution = "lnorm", censoring.side = "left",add.line = TRUE, main = "")

Unfortunately qqPlotCensored can do the fitting and QQ for only right or left and it does not have the ability to do it simultaneously. I am looking for a function or package to plot qq for both left and right at the same time.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I guess what I was getting at was, what is the end purpose? What are you doing with these data. Truncating Data is usually a bold action.