RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • bayesopt
    • classify
    • confusionmat
    • crossvalind
    • cvpartition
    • fitclinear
    • fitctree
    • fitlm
    • kmeans
    • knnsearch
    • lasso
    • lassoglm
    • linkage
    • lscov
    • mnrfit
    • optimizableVariable
    • pdist
    • pdist2
    • perfcurve
    • predict
    • regress
    • ridge
    • squareform
    • test
    • training
    • tsne

regress — Fit a multiple linear regression model by ordinary least squares.

regress(y,X) estimates coefficients for the linear model y = X*b. Include a column of ones in X when an intercept is required.

Syntax

b = regress(y, X)
b = regress(y, X, alpha)
[b, bint] = regress(y, X)
[b, bint] = regress(y, X, alpha)
[b, bint, r] = regress(y, X)
[b, bint, r] = regress(y, X, alpha)
All supported regress forms
b = regress(y, X)
b = regress(y, X, alpha)
[b, bint] = regress(y, X)
[b, bint] = regress(y, X, alpha)
[b, bint, r] = regress(y, X)
[b, bint, r] = regress(y, X, alpha)
[b, bint, r, rint] = regress(y, X)
[b, bint, r, rint] = regress(y, X, alpha)
[b, bint, r, rint, stats] = regress(y, X)
[b, bint, r, rint, stats] = regress(y, X, alpha)

Inputs

NameTypeRequiredDefaultDescription
yNumericArrayYes—Response vector.
XNumericArrayYes—Design matrix with observations in rows and model terms in columns.
alphaNumericScalarNo0.05Significance level for coefficient and residual intervals.

Returns

NameTypeDescription
bNumericArrayLeast-squares coefficient estimates.
bintNumericArrayConfidence intervals for coefficient estimates.
rNumericArrayRegression residuals for complete observations.
rintNumericArrayConfidence intervals for residuals.
statsNumericArrayRow vector [R2 F p errorVariance].

Returned values from regress depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:regress:InvalidArgumentInputs, dimensions, alpha, or requested output counts are malformed.regress: invalid argument
RunMat:regress:NumericalThe regression design cannot be solved numerically.regress: numerical failure
RunMat:regress:InternalRunMat cannot allocate or construct regression outputs.regress: internal error

How regress works

  • y must be a numeric vector with one element per row of X; X must be a 2-D numeric design matrix.
  • The documented computation domain is single or double. Native typed-integer y, X, and alpha are separately declared RunMat extensions; admitted values must be exactly representable at the explicit double regression boundary and MATLAB compatibility mode rejects them before gathering.
  • Rows containing NaN in y or any predictor are omitted before fitting.
  • alpha is optional and defaults to 0.05; it controls coefficient and residual confidence intervals.
  • Requested outputs follow MATLAB's [b,bint,r,rint,stats] form, including partial forms such as [b,bint] and [b,bint,r]. stats is [R2 F p errorVariance].
  • Rank-deficient designs use rank-revealing column pivoting, zero dependent-column coefficients, and return zero coefficient intervals for dependent columns.
  • Residual intervals use deleted-residual variance estimates for studentized residual diagnostics; interval outputs become NaN where degrees of freedom are insufficient.

Example

Fit a line with an explicit intercept column

X = [ones(4,1) (0:3)']; y = [1;3;5;7]; [b,bint,r,rint,stats] = regress(y,X)

Expected output:

b is approximately [1; 2] and stats(1) is 1.

Using regress with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how regress changes the result.

Run a small regress example, explain the result, then change one input and compare the output.

FAQ

Does regress add an intercept automatically?⌄

No. Match MATLAB usage by adding a column of ones to X when the model should include an intercept.

Related Stats functions

Ml

bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · lscov · mnrfit · optimizableVariable · pdist · pdist2 · perfcurve · predict · ridge · squareform · test · training · tsne

Summary

binocdf · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · fitdist · geomean · grpstats · harmmean · icdf · isoutlier · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pdf · prctile · quantile · refline · rmse · skewness · tabulate · tcdf · tiedrank · tinv · tpdf · ttest2 · wblinv

Random

binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd

Hist

histc · histcounts · histcounts2

Options

statget · statset

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how regress is executed, line by line, in Rust.

  • View the source for regress in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How regress works
  • Example
  • Fit a line with an explicit intercept column
  • Using regress with coding agents
  • FAQ
  • Related Stats functions
  • Ml
  • Summary
  • Random
  • Hist
  • Options
  • Open-source implementation
  • About RunMat