1
$\begingroup$

I am trying to fit a exponential curve to a vector of a data that presents a minimum value different from 0; i want to check the shape of the curve, so i do the following:

ex<-rexp(n=100,rate=0.6)

qqplot(mydata,ex) 

Doing like that the points don't lie on the line y=x, since the values of "mydata" are never less than 2 (instead of those of ex).

Is it possible to simulate a distribution with a given minimum value? even to fit on the histogram of my real data after that.

$\endgroup$
  • $\begingroup$ Is this 2 known to be the smallest possible or is it just that you don't see values below 2? If you're interested in a plot I wouldn't use random values for the ex, but some approximation for expected order statistics. In terms of the appearance of a more-or-less straight plot the shift parameter shouldn't matter. $\endgroup$ – Glen_b -Reinstate Monica Oct 5 '16 at 0:50
  • $\begingroup$ link 2 is known to be the smallest value (it's a treshold i use to get extreme wave data); the line on the qqplot is almost straigth anyway, but does'n have to lie on the x-y to demostrate the hypothesis? $\endgroup$ – F. De Leo Oct 6 '16 at 7:12
  • $\begingroup$ No, unless you explicitly hypothesize 0.6 and wanted to use the plot to assess that (you can check the parameter other ways -- but if you want to do it in the plot, you shift and scale for the hypothesized parameter values and compare with the y=x line). If you don't shift the values by 2 the intercept won't be 0 and if the scale of your observations is not the same as your random values then the slope won't be 1. (If you don't need to use the plot to assess the parameters, and just want to see if a shifted exponential fits then standard exponential scores are fine.) $\endgroup$ – Glen_b -Reinstate Monica Oct 6 '16 at 7:49
0
$\begingroup$

If you're interested in a plot I wouldn't use random values for the ex, but some approximation for expected order statistics. In terms of the appearance of a more-or-less straight plot the shift parameter and the rate parameter (or scale parameter, depending on your parameterization) shouldn't matter. I wouldn't bother with anything but expected scores for a standard exponential.

Actually the exact expected order statistics aren't hard to do so you could use those -- but it also doesn't make a huge amount of difference. I'm going to suggest using a quick approximation for all but the maximum order statistic, which we will do exactly.

Note that if you don't shift the scores by 2 the intercept won't be 0 and if the scale of your observations is not the same as your expected scores then the slope won't be 1. This in no way affects the usefulness of the plot -- standard exponential scores are fine. If you want to show a theoretical rate parameter of 0.6, you can plot a line with slope 1/0.6 and intercept 2.

Here's a random sample of simulated shifted exponential random variables with rate 0.6 and shift 2, plotted against approximate expected exponential scores:

y <- 2+rexp(100,0.6)

n <- length(y)
Ei <- qexp(ppoints(n)) # a good approximation apart from the last point
Ei[n] <- log(n)+.5772+0.5/n # better approximation for the last point

plot( y ~ Ei[order(order(y))], ylab="Sample quantiles", 
          xlab="Theoretical quantiles", main="Exponential Q-Q Plot")

[Another way to get a good approximation for all the points is to use qexp(ppoints(n,0.4385)) -- this is pretty reasonable for n>20 or so and gets better for larger n. It's less accurate for the last point at smaller n but accuracy for the last point generally matters less then]

Exponential Q-Q plot

The slope in the plot (the scale) could be approximated as
lm(I(y-2)~0+Ei[order(order(y))])$coefficients
implying a rate parameter of:

1/lm(I(y-2)~0+Ei[order(order(y))])$coefficients
       Ei 
0.5789898 

However, if you want to draw a line on the plot, a more robust approach, perhaps one based on quantiles like that in qqnorm probably makes more sense.

Pretty close to 0.6 (or you could calculate the ML estimate which is 1/mean(y-2), which is a little smaller in this case).

So the intercept and slope in this plot are informative, showing us the shift and scale parameter estimates for the shifted exponential.

--

If you want exact expected order statistics, see Did's answer here
Order statistics of i.i.d. exponentially distributed sample
-- but for typical sample sizes it makes such a small difference you can't see it, and my approximation is a bit shorter. If you prefer to use that, though, it's quite simple to do:

n <- length(y)
H <- cumsum(1/(1:length(y)))
Hn <- tail(H,1)
Ei <- Hn-rev(c(0,head(H,-1)))
$\endgroup$
2
$\begingroup$

A very simple method would be to add two to each observation in ex. It turns out that for an exponential distribution this is the same as simulating from an exponential distribution that is conditioned on being greater than two (this is called the memoryless property), and that seems to be what you what you want to compare your sample to.

$\endgroup$
  • $\begingroup$ you would just have to be careful in setting the absolute minimum; the model would necessarily fail to fit if you observe 2 as a minimum just due to sampling variation, whereas it is in fact e.g. 1.5 $\endgroup$ – Ray Oct 4 '16 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.