0

Is it possible to transform a normally distributed variable into one that defined by a truncated normal distribution?

I am currently using a KL transform to generate Gaussian random fields. I would like to transform these fields into truncated normally distributed fields with a specified mean and std. As I am using these random fields with the Polynomial Chaos Expansion (PCE) method to compute the low order statistics of the system, I don't know it mathematically correct to simply truncate my Gaussian fields.

For context, at the moment I am able to transform the Gaussian fields into uniformly distributed fields in the range [a,b] by using the following transformation: $x_{uni} = a + (b-a)\phi[x_{norm}]$ where $\phi[\cdot]$, is the gaussian cumulative distribution function.

Is there a similar transformation that I can apply to convert the Gaussian field into a truncated normal field?

Thanks in advance!

Trevor
  • 11
  • 3
  • Yes, just combine what you say with the inversion method, see https://stats.stackexchange.com/a/184337/77222 – Jarle Tufto May 12 '21 at 13:23
  • Well, once you have transformed your normal data into uniform data $x_{\text{uni}}$, you can plug $x_{\text{uni}}$ into the quantile function of the truncated normal, which should be available in most statistical software. – Stephan Kolassa May 12 '21 at 13:23
  • Why might you want to do this? It would make more sense to censor the distribution at $a$ and $b$ – Henry May 12 '21 at 13:29
  • 1
    This question needs to be made a little more precise. What would constitute a "similar transformation"? (For instance, one possibility would be to actually truncate your variable $x$!) Are you perhaps limiting this concept to the affine transformation of your example? Or would you admit smooth monotonic increasing transformations? Or any measurable function? – whuber May 12 '21 at 15:50
  • @whuber, apologies I should have clarified. I am using this transformation as part of a random field modelling (KL transform) process. My random field is modelled as a standard Gaussian field and I would like to transform this into a field defined using a truncated normal distribution. I don't know if it is mathematically correct to use a truncated normal distribution to generate the random field in the first place (I haven't come across this in literature). – Trevor May 12 '21 at 18:55
  • 1
    @Trevor Are you sure you're are not confusing truncation with censoring? – Jarle Tufto May 12 '21 at 19:21
  • Would the distributions all be truncated at the same values or would the truncation levels vary with location/time? – whuber May 12 '21 at 19:42

1 Answers1

0

Suppose $X \sim \mathsf{Norm}(\mu=12, \sigma=7)$ and $Y$ has the same distribution, but truncated to positive values. Then on $S_y=(0,\infty)$ the density of $Y$ is proportional to the density of $X,$ but it needs to be 'inflated' to integrate to unity on $(0,\infty).$ Let $k = \int_{S_Y}f_X(x)\, dx$ and $f_Y(y) = f_X(y)/k,$ for $y \in S_Y.$

Example using R: At right, the uninflated density is shown as a dotted line.

set.seed(2105)
x = rnorm(10000, 12, 7)
y = x[x >= 0]
par(mfrow = c(1,2))
 hist(x, prob=T, br=30, col="wheat")
  curve(dnorm(x, 12, 7), add=T, col="maroon")
 hist(y, prob=T, col="skyblue2")
 k = 1 - pnorm(0, 12, 7)
 curve(dnorm(x, 12, 7)/k, add=T, lwd=2)
  curve(dnorm(x, 12, 7), add=T, lwd=3, 
        lty="dotted", col="maroon")
par(mfrow = c(1,1))

enter image description here

BruceET
  • 47,896
  • 2
  • 28
  • 76
  • Thanks, this is very useful! Is it possible to do the same for a double truncated normal, for example if $S_y = (0,1)$? If I were to modify $\mu_Y, \sigma_Y$ is it simply a case of updating ```k = 1 - pnorm(0,10,5)``` and ```dnorm(x,10,5)/k``` for example? – Trevor May 13 '21 at 08:35
  • Same basic method to truncate both tails. // Not sure you you mean by 'modify' $\mu_y,\sigma_Y.$ They may, of course, be changed by truncation. – BruceET May 13 '21 at 15:38
  • thanks for your response. Okay, so if I were to truncate both tail, would it be ```k = 1 - pnorm(0,12,7) - pnorm(1,12,7,lower.tail = FALSE)``` if $S_y = (0,1)$? Apologies, I should have been more clear - by 'modify' I meant having a different mean and std for $Y$ compared to $X$. If $Y \sim truncNorm(\mu = 10, \sigma = 5)$ and $S_y = (0,1)$ would ```k = 1 - pnorm(0,12,7) - pnorm(1,12,7,lower.tail = FALSE)``` and ```curve(dnorm(x, 10, 5)/k, add=T, lwd=2)``` be the correct implementation? – Trevor May 13 '21 at 16:24
  • Seems you have the right approach to find $k$ for truncating both tails. You should try matching the histogram of the truncated dist'n to your density function. // If you truncate NORM(10,5) to (0,1) to get $Y$, Then $E(Y)\approx 0.53.$ By simulation, in R `set.seed(513)`, `x = rnorm(10^6, 10, 5); mean(x)` returns $9.993512$ and `y = x[(x>0)&(x<1)]`, `mean(y)` returns $0.5325912.$ – BruceET May 13 '21 at 17:14