Skip to content

Regressions

RegressionTables.jl produces formatted regression tables.

GLM (1.5)

GLM.jl is the package to run regressions.

GLM really expects the data to be provided as a DataFrame, but one can run

m = fit(LinearModel, X, y);

Then the intercept needs to be explicitly provided as a column of X.

Methods:

  • coef(m) returns values of coefficients
  • stderror(m) returns coefficient std errors
  • confint(m) produces confidence intervals by (regressor, lower/upper). But these are wrong in the current version of GLM (and the method no longer appears in the documentation).
  • predict(m) gives predicted values for original X values

It is currently not possible to compute confidence intervals for predicted values. There are open issues for this.

To save just the regression results (without the data, which could be a lot of memory), use coeftable(mdl). This produces a StatsBase.CoefTable.

Alternative, use RegressionTable from EconometricsLH.

Categorical regressors return names such as Symbol(“school: 3”).

A useful introduction is in the Cookbook.