# Monte Carlo simulation for fitting distributions (Weibull and log-normal)

I am working on a computer project which needs statistical analysis and I am not much of a statistic person. I have a Bluetooth (BT) detector device which detects passing Bluetooth devices (i.e one BT passed at time 0, one BT passed at time 3,....) and I used AIC to select the best distribution which describes the interarrival times. Now, I would like to do a Monte Carlo simulation to see what is the effect of detectable BT ratio (shown by lambda below and increased by 0.05 at each step) on the outcome. I have two options:

1. D = distribution with lowest AIC which describes interarrival times
theta = paramters of D which obtained by mle
z = number of detected BT
for (lambda in 0.05,0.1,0.15,..., 1)
{
P=generate z*lambda random numbers with D and theta
(like Lnorm(z*lambda,meanlog=10,sdlog=2) in r)
Find the best distribution and its paramters which fits P for further processing
}

2. this second approach is suggested by a statistician fiend:

Assume that you have fitted a log-Normal distribution to the BT data, and found parameters $\mu$ and $\sigma^2$ for the BT interarrival times:

$$\newcommand{\Var}{{\rm Var}} \newcommand{\LogNormal}{{\rm LogNormal}} \newcommand{\shape}{{\rm shape}} \newcommand{\scale}{{\rm scale}} Y \sim \LogNormal(\mu, \sigma^2)$$

with mean and variance of the BT interarrival times are

\begin{align} E[Y] &= \exp(\mu + 0.5*\sigma^2) \\ \Var[Y] &= (\exp(\sigma^2)-1) \exp(2*\mu + \sigma^2) \end{align} However you know that only a proportion lambda of devices are actually detected. That means that the true BT interarrival times are shorter than this. If X is the true interarrival time random variable then X is approximately $\lambda * Y$ on average, so you expect

$E[X] = \lambda * E[Y]$ and $\Var[X] = \lambda^2 * Var[Y]$

i.e., $E[X] = \lambda*\exp(\mu + 0.5*\sigma^2) = \exp((\mu+\delta) + 0.5*\sigma^2)$ and $\Var[X] = \lambda^2 * (\exp(\sigma^2)-1) \exp(2*\mu + \sigma^2) = (\exp(\sigma^2)-1) \exp(2*(\mu+\delta) + \sigma^2)$
where $\delta = \log(\lambda)$.
This suggests that
$X \sim \LogNormal(\mu+\delta, \sigma^2)$

Now, I have three questions and appreciate any help.

1. I cannot understand how he concluded the last line (i.e $X \sim \LogNormal(\mu+\delta, \sigma^2)$) (SOLVED)

2. How would the second approach work for the Weibull distribution, I know that:

\begin{align} E[\ln(W)] &= \ln(\scale)- (\gamma /\shape), \\ \Var[\ln(W)] &= (\pi^2)/(6 * \shape^2), \end{align} where $\gamma$ is the Euler constant, but I do not know how to extend this and find the effect of lambda on scale and shape in a similar way to the second approach. (SOLVED)

3. Why did my friend suggest the second approach, and what is wrong with the first approach?

• Re: Lognormal, long-winded version of stats.stackexchange.com/questions/224493/… . Re: Weibull, see stats.stackexchange.com/questions/224924/… . O.k., call me crazy, but rather than asking strangers on the internet, maybe you should ask your friend why he suggested the second approach. We haven't seen the data, and I have no idea what your optimal fitting did, or what the result was. Aug 21, 2016 at 1:03
• Perhaps your friend didn't see a good way of incorporating lambda into (as an adjustment to) the distribution you found per the AIC. Aug 21, 2016 at 1:26
• Thank you Mark for sending those links, The point is I do not have access to him anymore for the next couple of weeks as he is out of the country (of course with limited access to the Internet). Aug 21, 2016 at 2:39
• The first two questions have been solved with the links that Mark kindly provided. Aug 21, 2016 at 3:22