How to test whether a correlation is equal to 1? I am interested in an inferential test available in R which tests whether Pearson's $r = 1$ instead of whether $r = 0$. It would be good if the test allowed the correlation matrix and number of participants as input variables.
 A: I would argue that there is not any testing to do. If the sample correlation is not 1, then you reject $H_0: \rho=1$ with certainty.
Having a correlation of 1 means that the points cannot deviate from a diagonal line the way that they can when $\vert \rho \vert < 1$.
EDIT
set.seed(2019)
x <- rexp(1000)
y <- 3*x
plot(x,y)
V <- rep(NA,10000)
for (i in 1:length(V)){

  print(i)
  idx <- sample(seq(1,length(x),1),replace=T)
  V[i] <- cor(x[idx],y[idx])
}
summary(V)

With the points of the scatterplot locked to the diagonal line $y=3x$, every single sample correlation is 1. You can try this out with other distributions and sample sizes.
Where this gets interesting---and I'm not completely sure of the math at the population level---is when I set a Gaussian copula to have a parameter of 1.
library(copula)
set.seed(2019)
gc <-ellipCopula("normal", param = 1, dim = 2)#, dispstr = "un")
norm_exp <- mvdc(gc,c("norm","exp"),list(list(mean=0,sd=1),list(rate=1))) 
V <- rep(NA,10000)
for (i in 1:length(V)){
  print(i)
  D_ne <- rMvdc(1000, norm_exp) 
  x <- D_ne[,1]
  y <- D_ne[,2]
  V[i] <- cor(x[idx],y[idx])
}
plot(x,y)
summary(V)

I still don't think this relationship gives a population Pearson correlation of 1 (the relationship is perfectly monotonic but not linear), but this result surprised me. I expected another plot of a straight line.
To defend my assertion that the population Pearson correlation is not 1, I refer to theorem 4.5.7 on pg. 172 of the second edition of Casella & Berger's Statistial Inference: "$\vert \rho_{XY}\vert=1$ if and only if there exist numbers $a\ne0$ and $b$ such that $P(Y = aX+b)=1$." Since the relationship between my $X$ (the normal variable) and $Y$ (exponential) is nonlinear, there can be no such $a$ and $b$.
Casella, George, and Roger L. Berger. Statistical Inference. 2nd ed., Cengage Learning & Wadsworth, 2002.
A: Using the Fisher Z-transform is one way of doing this (usually used for confidence intervals), bootstrapping would be another.
Here's a brief article for Fisher Z transform for Pearson Product Moment Correlation Coefficient https://www.statisticshowto.datasciencecentral.com/fisher-z/
