RainbowStats™ · Regression commands
REGRESSION
Fit ordinary least squares.
Syntax
REGRESSION(list)
REGRESSION(y,x)
REGRESSION(list,dependentColumn)Returned object
RegressionOperator
Example
r=REGRESSION(LIST(LOGDIFF(INDPRO),LOGDIFF(PAYEMS)))
EXTRACT(r,"slideshow")Do the regression residuals drift over time?
Fit monthly housing starts against building permits over 2000–2024, then test the dated residuals for a monotonic trend.
Housing=SERIES_BETWEEN(LIST(HOUSTNSA,PERMITNSA),20000101,20241231)
Fit=REGRESSION(Housing)
Trend=EX(Fit,"mann_kendall")
EX(Trend,"slideshow")Read EX(Trend,"slope") as the estimated annual change in residuals, in units of the dependent variable. A positive slope means actual minus fitted tends to rise over time. Use EX(Fit,"autocorrelation") to inspect dependence in the original residuals. The Mann–Kendall p-value assumes independent observations and can be misleading when the residuals are serially correlated.
Interpretation and limitations
The first list entry is the dependent variable. A constant is added by the ordinary regression constructor. Inspect residuals and their autocorrelation. HAC changes inference rather than coefficient estimates. Wald extracts test the final three coefficients; the cumulative Wald variant uses the specialized 0–8 lag-polynomial weights 9, 36 and 204, so it is not a general cumulative-effect test. The two-series form interpolates y to x when frequencies differ and then aligns the date range. The list-and-column form uses the existing makeFirst index convention.
Available extracts
Save the command result in a variable, then use EXTRACT(result, "key"). Availability can depend on the input form and fitted model.
residualsmann_kendallreturns the trend operator on the fitted residual series.fittedactualvsfittedautocorrelationmodelslideshowbetabetasewaldwald_cumulativewald_textwald_cumulative_texthac
In indexed patterns such as beta:n, replace n with the required index.