# Testing if measurement comes from complex distribution (uniform plus normal)

I want test if measurement comes from my reference. I know reference distribution, for example it is:

$$X = f(A,B) \\ A \sim N(0, \sigma) \\ B \sim U(a,b) \\$$ $f(A,B)$ - some function of the variables, for example $f(A,B) = A + B$

Then I can run Monte Carlo (MC) simulation to simulate my distribution. On picture below you can see simulated distribution as blue line.

From the other hand I can simulate two distributions: $$X_{l} = f(A,a) \\ X_{u} = f(A,b) \\$$ Where $a,b$ are lower and uper limit of uniform distribution

If I want test if I can reject that measurement $x_m$ comes from reference distribution then I am not sure how to construct critical region in first case (from $X$). In second case when I have say uper and lower limit distribution and then I can construct one-tiled uper bound $X_{l}$ distribution and one-tiled lower bound for $X_{u}$. then I assume that p-value of the test can be calculated as sum p-values of uper and lower limit test variables: $$p = p_u + p_l$$ From the other hand maybe I can construct two tailed critical region for $X$ distribution where one tail is limited by $x_m$ and the second is limited by symmetric quantile. But in this case this test will produce lower p-values than bounduary test. In the example below it's quite natural for me that I do not want to reject $x_m = 1$ I am most intreated in case if I can reject $x_m = -0.1$ or $x_m = 4.3$ so the bounduary test is in this case seems to be more resonable. Moreover to test my measurement against $X$ test variable I think that I have to generate much more Monte Carlo samples than in bounduary case. In fact for bounduary test in this case i do not even have to use MC.

You don't need to simulate, this distribution has a closed-form solution!

If $Z\sim\mathcal{N}(0, \sigma)$ and $U \sim \mathcal{U}(a,b)$, then $Z+U$ follows a distribution described by Bhattacharjee, Pandit, and Mohan (1963), that has probability density function

$$f(x) = \frac{1}{2a} \left[\Phi\left(\frac{x-\mu+a}{\sigma}\right) - \Phi\left(\frac{x-\mu-a}{\sigma}\right)\right]$$

and cumulative distribution function

$$F(x) = \frac{\sigma}{2a} \left[(x-\mu)\Phi\left(\frac{x-\mu+a}{\sigma}\right) - (x-\mu)\Phi\left(\frac{x-\mu-a}{\sigma}\right) + \phi\left(\frac{x-\mu+a}{\sigma}\right) - \phi\left(\frac{x-\mu-a}{\sigma}\right)\right]$$

where $\Phi$ is standard normal cdf and $\phi$ is standard normal pdf.

In R you can find it's implementation (pdf, cdf and random generation) in extraDistr package.

Bhattacharjee, G.P., Pandit, S.N.N., and Mohan, R. (1963). Dimensional chains involving rectangular and normal error-distributions. Technometrics, 5, 404-406.

• Thank you for your answer. In fact I have more complicated distirbution than $Z + U$. The question was more related to what is the concequences of testing my hypothesis using 'bounduary test' instead of lest say 'clasic one'. – Staszko90 Dec 22 '16 at 11:20