RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

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.

/
See all docs
Builtin Reference
    • bayesopt
    • classify
    • confusionmat
    • crossvalind
    • cvpartition
    • fitclinear
    • fitctree
    • fitlm
    • kmeans
    • knnsearch
    • lasso
    • lassoglm
    • linkage
    • lscov
    • mnrfit
    • nlparci
    • 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

y
Type
NumericArray
Required
Yes
Description
Response vector.
X
Type
NumericArray
Required
Yes
Description
Design matrix with observations in rows and model terms in columns.
alpha
Type
NumericScalar
Required
No
Default
0.05
Description
Significance level for coefficient and residual intervals.
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

b
Type
NumericArray
Description
Least-squares coefficient estimates.
bint
Type
NumericArray
Description
Confidence intervals for coefficient estimates.
r
Type
NumericArray
Description
Regression residuals for complete observations.
rint
Type
NumericArray
Description
Confidence intervals for residuals.
stats
Type
NumericArray
Description
Row vector [R2 F p errorVariance].
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

RunMat:regress:InvalidArgument
When
Inputs, dimensions, alpha, or requested output counts are malformed.
Message
regress: invalid argument
RunMat:regress:Numerical
When
The regression design cannot be solved numerically.
Message
regress: numerical failure
RunMat:regress:Internal
When
RunMat cannot allocate or construct regression outputs.
Message
regress: internal error
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

Inputs and computation

y is a numeric response vector with one value per row of the two-dimensional design matrix X. The documented floating computation admits single and double. Typed-integer y, X, and alpha are RunMat extensions: each integer must cross the checked exact binary64 boundary, and MATLAB compatibility mode rejects the extension before provider access. Logical y and X are also admitted by the current host conversion.

Rows with NaN in y or any predictor are omitted. An Inf in y or X is an error. The optional significance level alpha defaults to 0.05 and must be a scalar in [0,1). A rank-deficient design uses rank-revealing column selection; dependent coefficients and their intervals are zero.

Outputs and execution

The requested outputs are [b,bint,r,rint,stats], including partial forms. Coefficient intervals are in bint. Residuals and their studentized, deleted-variance intervals are in r and rint. The 1-by-4 stats row contains [R2 F p errorVariance]. Interval values can be NaN when the available degrees of freedom are insufficient.

Admitted GPU inputs are gathered to host. The SVD-backed coefficient fit and interval diagnostics run on CPU; there is no provider-native regression kernel, GPU fusion, or implicit intercept term.

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. Add 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 · nlparci · optimizableVariable · pdist · pdist2 · perfcurve · predict · ridge · squareform · test · training · tsne

Summary

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

Random

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

Hist

histc · histcounts · histcounts2

Options

statget · statset

Source you can read

Every RunMat function's source is public. 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 a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Inputs and computation
  • Outputs and execution
  • Example
  • Fit a line with an explicit intercept column
  • Using regress with coding agents
  • FAQ
  • Related Stats functions
  • Ml
  • Summary
  • Random
  • Hist
  • Options
  • Source you can read
  • About RunMat