corrinv

computes the quantiles of the sampling distribution of the correlation coefficient

Syntax

Description

example

x =corrinv(p, rho, n) An example where p, rho and n are all scalars.

Examples

expand all

  • An example where p, rho and n are all scalars.
  • Find x030 such that Pr(r<x030|rho=0.1, n=12)=0.3.

    p=0.3;
    rho=0.1;
    n=12;
    rhos=num2str(rho);
    ns=num2str(n);
    x030=corrinv(p,rho,n);
    disp(['Quantile x030 in f(r |rho=' rhos, ', n=' ns ')= '  num2str(x030)])
    disp('In other words, the probability of obtaining values')
    disp(['of the sample correlation coefficient smaller than' num2str(x030)])
    disp(['is equal to 0.3 when rho='  rhos, ' and n=' ns ])
    Quantile x030 in f(r |rho=0.1, n=12)= -0.064951
    In other words, the probability of obtaining values
    of the sample correlation coefficient smaller than-0.064951
    is equal to 0.3 when rho=0.1 and n=12
    

    Related Examples

    expand all

  • p is not scalar.
  • p=(0.1:0.1:0.9)';
    rho=0;
    n=12;
    rhos=num2str(rho);
    ns=num2str(n);
    x=corrinv(p,rho,n);
    nam={['rho=' rhos, ', n=' ns]};
    Xt=array2table(x,"RowNames","x"+p,"VariableNames",nam);
    disp(Xt)
                rho=0, n=12
                ___________
    
        x0.1       -0.39813
        x0.2       -0.26792
        x0.3       -0.16891
        x0.4      -0.082148
        x0.5    -0.00017943
        x0.6       0.081779
        x0.7        0.16851
        x0.8        0.26744
        x0.9        0.39742
    
    

  • An example where rho is not scalar.
  • p=0.3;
    rho=(0:0.1:0.8)';
    n=12;
    x=corrinv(p,rho,n);
    nam={['x' num2str(p) ' when, n=' num2str(n)]};
    Xt=array2table(x,"RowNames","rho="+rho,"VariableNames",nam);
    disp(Xt)
                   x0.3 when, n=12
                   _______________
    
        rho=0          -0.16891   
        rho=0.1       -0.064951   
        rho=0.2        0.042575   
        rho=0.3         0.15349   
        rho=0.4         0.26757   
        rho=0.5         0.38455   
        rho=0.6          0.5041   
        rho=0.7         0.62585   
        rho=0.8         0.74939   
    
    

    Input Arguments

    expand all

    p — Probability at which the inverse of the cdf must be evaluated $0 \leq p \leq 1$. Scalar, vector or matrix 3D array of the same size of x and b.

    A scalar input functions as a constant matrix of the same size as the other input.

    Data Types: single | double

    rho — Value of the correlation coefficient in the population. Scalar, vector or matrix or 3D array.

    If rho is not a scalar all the 3 input arguments (p,rho and n) must have the same size or just the numel of one of the 3 input arguments must be greater than 1

    Data Types: single | double

    n — Sample size. Scalar, vector or matrix or 3D array.

    If n is not a scalar all the 3 input arguments (p,rho and n) must have the same size or just the numel of one of the 3 input arguments must be greater than 1

    Data Types: single | double

    Output Arguments

    expand all

    x —Inverse cdf value. Scalar, vector or matrix or 3D array of the same size of input arguments p, rho and n

    $p=\int_{-1}^x f_{r}(r | \rho,n) dr$ is the inverse of the sample correlation coefficient cdf, given $\rho$, the population correlation coefficient and the sample size $n$, for the corresponding probabilities in p.

    References

    Das Gupta, S. (1980). Distribution of the Correlation Coefficient, in: Fienberg, S.E., Hinkley, D.V. (eds) R.A. Fisher: An Appreciation, Lecture Notes in Statistics, vol 1. Springer, New York, NY.

    https://doi.org/10.1007/978-1-4612-6079-0_3

    Acknowledgements

    For additional information see https://mathworld.wolfram.com/CorrelationCoefficientBivariateNormalDistribution.html This function follows the lines of MATLAB code developed by Xu Cui, and the file exchange submission Joshua Carmichael (2022), sample correlation distribution function https://www.mathworks.com/matlabcentral/fileexchange/45785-sample-correlation-distribution-function/

    See Also

    |

    This page has been automatically generated by our routine publishFS