Suppose the marginal distributions of $X$ and $Y$ are both $U[a,b]$, where $U[a,b]$ denotes uniform distribution on $[a,b]$. When $X$ and $Y$ are correlated, how to write their joint density for some prespecified measure of correlation?

  • 2
    $\begingroup$ In case it comes up, and I think it will (or at least should), do you know the term “copula”? Also, do you have a plot in mind? It would help to have some idea of what you mean by correlation. For instance, according to you, for $X \sim U(0,1)$, are $X$ and $X^2$ correlated even though the relationship isn’t linear? (Remember that for this $X$, $cor(X,X^2)\ne 0$.) $\endgroup$
    – Dave
    Commented May 30, 2020 at 3:57
  • $\begingroup$ @Dave Thanks. Yes, the correlation is not restricted to be linear. I guess indeed copula need to be used here. $\endgroup$ Commented May 30, 2020 at 5:25
  • $\begingroup$ One possibility, with positive correlation is as follows: $f(x,y) = 2$ if $0<x<\frac12, 0<y<\frac12$ or $\frac12 < x <1, \frac 12 < y <1$, and 0 otherwise. Another with positive correlation has $X\equiv Y,$ concentrating all probability on a line. Similarly, $X\equiv -Y$ has negative correlation. $\endgroup$
    – BruceET
    Commented May 30, 2020 at 6:49
  • $\begingroup$ @BruceET in your first example, is that just filling in the first and third quadrants (so to speak)? $\endgroup$
    – Dave
    Commented May 30, 2020 at 7:07
  • $\begingroup$ @Dave: That was my intention; never quite sure how JaX works in Comment mode. $\endgroup$
    – BruceET
    Commented May 30, 2020 at 7:27

1 Answer 1


I think the right place to start is what correlation means in a nicer setting: Gaussian, of course.

In the bivariate Gaussian distribution, the population correlation is given by the $\rho$ parameter. This tells us something about the fit to a line.

I have tried fitting marginal uniform distributions to a line and failed, but we can still get at the $\rho$ parameter of the bivariate Gaussian.

That $\rho$ parameter is the parameter of the bivariate Gaussian copula, and we can use a Gaussian copula with more than just Gaussian marginal distributions. We can use uniform marginal distributions and specify the parameter in the Gaussian copula, giving us a way to describe the relationship between the two marginal distributions.

When I have simulated this, I have not gotten the sample correlation to be the specified parameter of the Gaussian copula, so I do not know if this quite counts as specifying the correlation. However, the estimate in R's cor function is biased, perhaps accounting for this discrepency. I welcome discussion in the comments about this topic.

(Remember that a biased estimator isn't inherently a bad estimator; in fact, $s$ is a biased estimator for standard deviation, even though $s^2$ is unbiased for variance, so we use biased estimators all the time.)

N <- 1000
R <- 10000

# define the copula
nc <- normalCopula(param = 0.81)

# Define the population distribution with the nc copula and U(0,2) marginals
unif_unif <- mvdc(nc, c("unif","unif"),list(list(min=0, max=2),list(min=0, max=2)))
v <- rep(NA, R)
for (i in 1:R){

  # Sample from the population
  D_uu <- rMvdc(N, unif_unif)

  # Calculate the correlation
  v[i] <- cor(D_uu[,1], D_uu[,2])
  if (i %% 250 == 0){print(i)}
mean(v) # 0.7963396, slightly lower than the specified 0.81


Let's look at some pictures. Here is the last distribution produced in the simulation: plot(D_uu).

enter image description here

Now compare to a bivariate normal distribution with population correlation $0.81$: plot(qnorm(D_uu[, 1]/2), qnorm(D_uu[, 2]/2)). (This uses the same (Gaussian) copula to relate the marginals but gives each marginal a normal distribution.)

enter image description here

Both plots have the data kind of hugging the line $y=x$, and both see a bulge in the perpendicular direction. However, the behavior of the marginal normal distributions causes more points to be near the mean than in the marginal uniform distributions (consider the PDFs).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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