{
  "name": "Pearson correlation functions in MATLAB, GNU Octave and SciPy",
  "description": "Compares the documented behaviour of MATLAB corrcoef and corr, GNU Octave corr and corrcoef, and SciPy pearsonr: default correlation type, p-value output, confidence bounds, missing-value handling and two-input behaviour. Compiled from each project's own reference documentation.",
  "page": "https://casrai.org/guides/pearson-correlation-matlab",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-18T02:32:20Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Function",
      "unit": "",
      "description": ""
    },
    {
      "name": "Default correlation type",
      "unit": "",
      "description": ""
    },
    {
      "name": "P-value output",
      "unit": "",
      "description": ""
    },
    {
      "name": "Confidence bounds",
      "unit": "",
      "description": ""
    },
    {
      "name": "Missing-value handling",
      "unit": "",
      "description": ""
    },
    {
      "name": "Two-input behaviour",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Function": "MATLAB corrcoef",
      "Default correlation type": "Pearson",
      "P-value output": "Second output P",
      "Confidence bounds": "Third and fourth outputs RL, RU (Alpha default 0.05)",
      "Missing-value handling": "Rows: all (default), complete, pairwise",
      "Two-input behaviour": "Flattens inputs to X(:), Y(:) and returns one 2-by-2 matrix"
    },
    {
      "Function": "MATLAB corr (Statistics and Machine Learning Toolbox)",
      "Default correlation type": "Pearson (also Kendall, Spearman)",
      "P-value output": "Second output pval; Tail both (default), right, left",
      "Confidence bounds": "Not listed in the syntax read",
      "Missing-value handling": "Rows: all (default), complete, pairwise",
      "Two-input behaviour": "Column-by-column matrix between columns of X and columns of Y"
    },
    {
      "Function": "GNU Octave corrcoef",
      "Default correlation type": "Pearson",
      "P-value output": "Second output p",
      "Confidence bounds": "Third and fourth outputs lci, hci (alpha default 0.05)",
      "Missing-value handling": "rows: all (default), complete, pairwise",
      "Two-input behaviour": "Coefficients for x and y as variables"
    },
    {
      "Function": "GNU Octave corr",
      "Default correlation type": "Correlation as cov(A,B) / (std(A) * std(B))",
      "P-value output": "Not in the documented syntax",
      "Confidence bounds": "Not in the documented syntax",
      "Missing-value handling": "Scalar or single-row input returns NaN",
      "Two-input behaviour": "Correlation between each column of x and each column of y"
    },
    {
      "Function": "SciPy stats.pearsonr",
      "Default correlation type": "Pearson",
      "P-value output": "pvalue attribute (assumes normal distributions)",
      "Confidence bounds": "confidence_interval() method",
      "Missing-value handling": "Constant input gives ConstantInputWarning and NaN",
      "Two-input behaviour": "Two arrays x and y of length 2 or more"
    }
  ],
  "sources": [
    {
      "title": "MathWorks: corrcoef",
      "url": "https://www.mathworks.com/help/matlab/ref/corrcoef.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "MathWorks: corr",
      "url": "https://www.mathworks.com/help/stats/corr.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "GNU Octave: Correlation and Regression Analysis",
      "url": "https://docs.octave.org/latest/Correlation-and-Regression-Analysis.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "SciPy: scipy.stats.pearsonr",
      "url": "https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.pearsonr.html",
      "accessed": "2026-11-17"
    }
  ]
}