# \#glm

**URL:** https://discourse.julialang.org/tag/glm/351.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Proposal for TuringRegressions.jl - Bayesian regression model alternative to TuringGLM.jl](https://discourse.julialang.org/t/proposal-for-turingregressions-jl-bayesian-regression-model-alternative-to-turingglm-jl/138815)

<div class="topic-metadata">

**Author:** [@jalster](https://discourse.julialang.org/u/jalster)\
**Replies:** 7\
**Last updated:** [August 22, 2026, 12:10pm UTC](https://discourse.julialang.org/t/proposal-for-turingregressions-jl-bayesian-regression-model-alternative-to-turingglm-jl/138815 "2026-08-22T12:10:35Z")

</div>

Hi everyone, I would like to propose TuringRegressions.jl - a more fully featured alternative to TuringGLM.jl offering much more of what brms does in R, most notably: correlated random effect slopes, i.e. full support…

---

## [How to obtain the pvalues of the coefficients in GLM.jl?](https://discourse.julialang.org/t/how-to-obtain-the-pvalues-of-the-coefficients-in-glm-jl/9531)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [December 19, 2025, 9:50pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-pvalues-of-the-coefficients-in-glm-jl/9531 "2025-12-19T21:50:09Z")

</div>

I have fitted a model using DataFrames df = DataFrame( x = 2\*y + 1 + rand(100), y = rand(100) ) using GLM mdl = lm(@formula(y~x), df) now I can see the pvalues of the coefficients. How do I obtain the pvalues and s…

---

## [Analysis of binomial counts using glm](https://discourse.julialang.org/t/analysis-of-binomial-counts-using-glm/132837)

<div class="topic-metadata">

**Author:** [@RobertDorazio](https://discourse.julialang.org/u/RobertDorazio)\
**Replies:** 11\
**Last updated:** [October 4, 2025, 1:51pm UTC](https://discourse.julialang.org/t/analysis-of-binomial-counts-using-glm/132837 "2025-10-04T13:51:18Z")

</div>

It seems as though the glm() function in Julia does not always yield the maximum likelihood estimates of parameters when fitting logistic regression models of binomial count data. Moreover, the uncertainties of the para…

---

## [Predict values using multinomial logistic regression?](https://discourse.julialang.org/t/predict-values-using-multinomial-logistic-regression/128621)

<div class="topic-metadata">

**Author:** [@Paulogcd](https://discourse.julialang.org/u/Paulogcd)\
**Replies:** 1\
**Last updated:** [May 2, 2025, 11:39am UTC](https://discourse.julialang.org/t/predict-values-using-multinomial-logistic-regression/128621 "2025-05-02T11:39:16Z")

</div>

Dear Julia community :slightly\_smiling\_face:, I have been trying to run a Multinomial logistic regression and to get the estimated results from a certain set of values. I managed to run the regression, but fail to get …

---

## [Using GLM programmatically](https://discourse.julialang.org/t/using-glm-programmatically/30828)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 8\
**Last updated:** [October 8, 2024, 8:13am UTC](https://discourse.julialang.org/t/using-glm-programmatically/30828 "2024-10-08T08:13:07Z")

</div>

I would like to perform linear regression in a loop with variables. For example, using DataFrames, GLM data = DataFrame(X=\[1,2,3\], Y=\[2,4,7\]) var1 = :Y var2 = :X ols = lm(@formula($var1 ~ $var2), data) I tried vari…

---

## [Why does GLM.jl fail to fit my logistic regression model but scikit learn and R has no issues? I think I found the reason](https://discourse.julialang.org/t/why-does-glm-jl-fail-to-fit-my-logistic-regression-model-but-scikit-learn-and-r-has-no-issues-i-think-i-found-the-reason/118553)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [October 1, 2024, 2:43pm UTC](https://discourse.julialang.org/t/why-does-glm-jl-fail-to-fit-my-logistic-regression-model-but-scikit-learn-and-r-has-no-issues-i-think-i-found-the-reason/118553 "2024-10-01T14:43:54Z")

</div>

I have been trying to use GLM.jl to fit some logistic regression models and the fit failed. I don’t remember the exact error message but it was something about singularity. That annoyed me for a couple of years but I ne…

---

## [Plot the confidence interval for a model fit](https://discourse.julialang.org/t/plot-the-confidence-interval-for-a-model-fit/37767)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 20\
**Last updated:** [September 24, 2021, 12:43pm UTC](https://discourse.julialang.org/t/plot-the-confidence-interval-for-a-model-fit/37767 "2021-09-24T12:43:53Z")

</div>

I’m no data scientist, so it’s likely that my question does not make much sense… But here goes: I recently tried to do some data analysis that involved fitting models. I’m able to fit the model, compute represent a pred…

---

## [Weightened linear model in GLM.jl](https://discourse.julialang.org/t/weightened-linear-model-in-glm-jl/119962)

<div class="topic-metadata">

**Author:** [@achjaj](https://discourse.julialang.org/u/achjaj)\
**Replies:** 3\
**Last updated:** [September 28, 2024, 6:21am UTC](https://discourse.julialang.org/t/weightened-linear-model-in-glm-jl/119962 "2024-09-28T06:21:28Z")

</div>

Hi, I want to fit a plane to measured points, i.e., the function Z = aX + bY + c to data, where the Z coordinate (dependent variable) has a measurement error \\sigma. The documentation for GLM.jl mentions that lm functio…

---

## [EM algorithm for HMM-GLM models in Julia?](https://discourse.julialang.org/t/em-algorithm-for-hmm-glm-models-in-julia/119136)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 5\
**Last updated:** [September 6, 2024, 7:42pm UTC](https://discourse.julialang.org/t/em-algorithm-for-hmm-glm-models-in-julia/119136 "2024-09-06T19:42:29Z")

</div>

Hi all, Is there anyone here who tried to use Julia for HMM-GLM models using Expectation Maximization? I’m looking for good references to try it out. I looked at HiddenMarkovModels.jl but I’m not sure how to use it to …

---

## [Multi-step prediction of autoregressive model from StatsModels](https://discourse.julialang.org/t/multi-step-prediction-of-autoregressive-model-from-statsmodels/113089)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 4\
**Last updated:** [July 3, 2024, 7:43pm UTC](https://discourse.julialang.org/t/multi-step-prediction-of-autoregressive-model-from-statsmodels/113089 "2024-07-03T19:43:50Z")

</div>

If I have some electricity demand, it is reasonable to assume that it will be similar to the day before. So with hourly data, 24 steps before. Additional influences are also present: using StatsModels, DataFrames, GLM N…

---

## [Extracting the loglikelihood function from GLM?](https://discourse.julialang.org/t/extracting-the-loglikelihood-function-from-glm/113849)

<div class="topic-metadata">

**Author:** [@alexfakos](https://discourse.julialang.org/u/alexfakos)\
**Replies:** 6\
**Last updated:** [May 9, 2024, 8:54pm UTC](https://discourse.julialang.org/t/extracting-the-loglikelihood-function-from-glm/113849 "2024-05-09T20:54:49Z")

</div>

I am trying to extract the loglikelihood function that maps the parameter vector to each observation. The goal is to use the likelihood function to generate the score and hessian for each observation to use for inference…

---

## [How to extract the Std. Error of a linear regression model by GLM?](https://discourse.julialang.org/t/how-to-extract-the-std-error-of-a-linear-regression-model-by-glm/113793)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 3\
**Last updated:** [May 3, 2024, 3:10pm UTC](https://discourse.julialang.org/t/how-to-extract-the-std-error-of-a-linear-regression-model-by-glm/113793 "2024-05-03T15:10:39Z")

</div>

How to extract the Std. Error of a linear regression model by GLM.jl? julia\> using GLM julia\> x = rand(10); y = rand(10); julia\> lr = lm(@formula(y~x), (;x, y)) StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{…

---

## [Aic in GLM](https://discourse.julialang.org/t/aic-in-glm/6229)

<div class="topic-metadata">

**Author:** [@LewisHein](https://discourse.julialang.org/u/LewisHein)\
**Replies:** 2\
**Last updated:** [April 9, 2024, 3:17am UTC](https://discourse.julialang.org/t/aic-in-glm/6229 "2024-04-09T03:17:47Z")

</div>

Hey everyone, I am trying to get the AIC of a model in GLM. It’s just a simple regression model with an identity link function. Yet, the call to aic(mod) says that my model is not a subtype of StatisticalModel. Shouldn…

---

## [Expressing multivariate repsonse with StatsModels.@formula](https://discourse.julialang.org/t/expressing-multivariate-repsonse-with-statsmodels-formula/111705)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 0\
**Last updated:** [March 16, 2024, 7:08pm UTC](https://discourse.julialang.org/t/expressing-multivariate-repsonse-with-statsmodels-formula/111705 "2024-03-16T19:08:03Z")

</div>

Hi all, I’m trying to model a multivariate response variable using GLM.jl (and potentially MixedModels.jl at a later point). I know that there isn’t first-class support for this, but people usually suggest introducing a…

---

## [Nesting the GLM.jl in the objective function when formulating the ReverseDiff gradient generates StackOverflowError](https://discourse.julialang.org/t/nesting-the-glm-jl-in-the-objective-function-when-formulating-the-reversediff-gradient-generates-stackoverflowerror/107050)

<div class="topic-metadata">

**Author:** [@xxxxx](https://discourse.julialang.org/u/xxxxx)\
**Replies:** 5\
**Last updated:** [December 4, 2023, 8:01pm UTC](https://discourse.julialang.org/t/nesting-the-glm-jl-in-the-objective-function-when-formulating-the-reversediff-gradient-generates-stackoverflowerror/107050 "2023-12-04T20:01:54Z")

</div>

Hi, in formulating my objective function for optimization, in one of the steps, the parameters will enter a Poisson regression as the weight, which I implemented through GLM.jl package. However, when generating the gradi…

---

## [Any way to efficiently run Poisson regression thousands of times?](https://discourse.julialang.org/t/any-way-to-efficiently-run-poisson-regression-thousands-of-times/106727)

<div class="topic-metadata">

**Author:** [@xxxxx](https://discourse.julialang.org/u/xxxxx)\
**Replies:** 23\
**Last updated:** [December 4, 2023, 3:44pm UTC](https://discourse.julialang.org/t/any-way-to-efficiently-run-poisson-regression-thousands-of-times/106727 "2023-12-04T15:44:18Z")

</div>

I need to run Poisson regression around 3000 times with the same set of Y and X but different weights. I’m currently using GLM.jl with a for-loop. The whole thing takes about 58 seconds. I was wondering if there are more…

---

## [Removing coefficients in GLM](https://discourse.julialang.org/t/removing-coefficients-in-glm/105772)

<div class="topic-metadata">

**Author:** [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Replies:** 3\
**Last updated:** [November 4, 2023, 5:22pm UTC](https://discourse.julialang.org/t/removing-coefficients-in-glm/105772 "2023-11-04T17:22:03Z")

</div>

Hello I have the following result for my GLM analysis: julia\> gm1 = fit(GeneralizedLinearModel, @formula(compte ~ exp27 + exp26 + exp25+ exp24 + exp27\*exp26\*exp25\*exp24), viewbits, Poisson()) StatsModels.TableRegressio…

---

## [Regression Variance Inflation Factor (VIF)](https://discourse.julialang.org/t/regression-variance-inflation-factor-vif/60233)

<div class="topic-metadata">

**Author:** [@Storopoli](https://discourse.julialang.org/u/Storopoli)\
**Replies:** 7\
**Last updated:** [September 1, 2023, 5:54am UTC](https://discourse.julialang.org/t/regression-variance-inflation-factor-vif/60233 "2023-09-01T05:54:45Z")

</div>

Hello, how do I check for VIF Variance inflation factor - Wikipedia in a GLM.jl lm model? I went through the JuliaStats org repositories and package documentations and could not find anything.

---

## [What are the t-tests in the GLM.jl's models?](https://discourse.julialang.org/t/what-are-the-t-tests-in-the-glm-jls-models/103261)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 7\
**Last updated:** [August 28, 2023, 7:38pm UTC](https://discourse.julialang.org/t/what-are-the-t-tests-in-the-glm-jls-models/103261 "2023-08-28T19:38:53Z")

</div>

Hi all, I’m not sure about the meaning of the pretty prints of GLM.jl’s models: julia\> model StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}}, GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPiv…

---

## [How can I substitute NaN in a GLM model with zeroes?](https://discourse.julialang.org/t/how-can-i-substitute-nan-in-a-glm-model-with-zeroes/102038)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [July 24, 2023, 7:44pm UTC](https://discourse.julialang.org/t/how-can-i-substitute-nan-in-a-glm-model-with-zeroes/102038 "2023-07-24T19:44:03Z")

</div>

Hi all! I have a linear model, created with GLM.jl. Since I correlated some variables with a categorical one, I have lots of NaN as coefficients, when the data are provided for only some of the categorical values: juli…

---

## [How do I do a regression using programatically defined column names?](https://discourse.julialang.org/t/how-do-i-do-a-regression-using-programatically-defined-column-names/101963)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 4\
**Last updated:** [July 24, 2023, 12:44am UTC](https://discourse.julialang.org/t/how-do-i-do-a-regression-using-programatically-defined-column-names/101963 "2023-07-24T00:44:47Z")

</div>

I have a dataframe with many columns. For example, df = DataFrame(A = randn(10), B = randn(10), C = randn(10), D = randn(10)) nms = names(df) I want to do a regression of column A on one or more of the other columns. …

---

## [How can I use a linear model with NaN parameters due to missing train data?](https://discourse.julialang.org/t/how-can-i-use-a-linear-model-with-nan-parameters-due-to-missing-train-data/101648)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [July 15, 2023, 10:09am UTC](https://discourse.julialang.org/t/how-can-i-use-a-linear-model-with-nan-parameters-due-to-missing-train-data/101648 "2023-07-15T10:09:28Z")

</div>

Hi all! I am trying to build a model to predict electrical powers from a sequence of binary computer instructions. I thought to use a multiple linear regression, as from each instruction there are a lot of variables I c…

---

## [Can I do linear regression over physical data with Unitful?](https://discourse.julialang.org/t/can-i-do-linear-regression-over-physical-data-with-unitful/99229)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [May 22, 2023, 3:27pm UTC](https://discourse.julialang.org/t/can-i-do-linear-regression-over-physical-data-with-unitful/99229 "2023-05-22T15:27:17Z")

</div>

Hi all! I want to fit a multiple linear model on some data I collected. I decorated my data with units of measure using Unitful.jl, and I use GLM.jl’s lm function to produce the model. However, I can’t make it work. To …

---

## [Tweedie distribution / Tweedie GLM](https://discourse.julialang.org/t/tweedie-distribution-tweedie-glm/44091)

<div class="topic-metadata">

**Author:** [@m-a](https://discourse.julialang.org/u/m-a)\
**Replies:** 2\
**Last updated:** [April 9, 2023, 2:15pm UTC](https://discourse.julialang.org/t/tweedie-distribution-tweedie-glm/44091 "2023-04-09T14:15:05Z")

</div>

I’m interested in fitting a GLM via GLM.jl with a Tweedie distribution (Tweedie distribution - Wikipedia), particularly when the domain of the index parameter is not a special case that’s already available. Something lik…

---

## [How can I perform GLM regression on column names with spaces?](https://discourse.julialang.org/t/how-can-i-perform-glm-regression-on-column-names-with-spaces/96442)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 6\
**Last updated:** [March 22, 2023, 5:06pm UTC](https://discourse.julialang.org/t/how-can-i-perform-glm-regression-on-column-names-with-spaces/96442 "2023-03-22T17:06:37Z")

</div>

Hi all, very noob question but I can’t find an answer. I’m trying to do a linear regression on some data I have: julia\> df\_under\_test\[:, \[instruction\_sym, measure\_power\_sym, binary\_weight\_sym\]\] 1165×3 DataFrame Row │…

---

## [Linear regression without the intercept term](https://discourse.julialang.org/t/linear-regression-without-the-intercept-term/18063)

<div class="topic-metadata">

**Author:** [@leejm516](https://discourse.julialang.org/u/leejm516)\
**Replies:** 7\
**Last updated:** [March 8, 2023, 9:14am UTC](https://discourse.julialang.org/t/linear-regression-without-the-intercept-term/18063 "2023-03-08T09:14:32Z")

</div>

In GLM.jl, the use of DataFrame is preferred, but the lm function does support the use of vectors and matrices. In the latter case, however, I can’t do fit without the intercept term (i.e. b0 = 0). Is there a way to do t…

---

## [What is the difference between the two methods of lm on GLM.jl](https://discourse.julialang.org/t/what-is-the-difference-between-the-two-methods-of-lm-on-glm-jl/95140)

<div class="topic-metadata">

**Author:** [@dpabon](https://discourse.julialang.org/u/dpabon)\
**Replies:** 2\
**Last updated:** [February 25, 2023, 3:00pm UTC](https://discourse.julialang.org/t/what-is-the-difference-between-the-two-methods-of-lm-on-glm-jl/95140 "2023-02-25T15:00:17Z")

</div>

The application of each one of the methods produced a different result: using DataFrames using GLM new\_x = rand(100,3) new\_y = rand(100) GLM.lm(new\_x, new\_y) Produce: LinearModel{GLM.LmResp{Vector{Float64}}, GLM.Den…

---

## [Using all independent variables with @formula in a multiple linear model](https://discourse.julialang.org/t/using-all-independent-variables-with-formula-in-a-multiple-linear-model/43691)

<div class="topic-metadata">

**Author:** [@pauloat](https://discourse.julialang.org/u/pauloat)\
**Replies:** 18\
**Last updated:** [January 29, 2023, 4:56pm UTC](https://discourse.julialang.org/t/using-all-independent-variables-with-formula-in-a-multiple-linear-model/43691 "2023-01-29T16:56:04Z")

</div>

Hi, I’m trying to learn how to do linear models and wanted to know if there something like in R, where you can use a dot (“.”) instead of writing all the indepent variables in a linear regression model, for example in R: …

---

## [Huge CPU load when using GLM](https://discourse.julialang.org/t/huge-cpu-load-when-using-glm/89209)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 14\
**Last updated:** [October 25, 2022, 2:52am UTC](https://discourse.julialang.org/t/huge-cpu-load-when-using-glm/89209 "2022-10-25T02:52:29Z")

</div>

Hello all I’m using GLM to calculate coefficients for logistic regression. I don’t recall this being an issue when I first developed this script, but recently, I’ve noticed that this script is generating a huge load on…

---

## [How can I tell Julia what are the parameters in a linear model?](https://discourse.julialang.org/t/how-can-i-tell-julia-what-are-the-parameters-in-a-linear-model/87692)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 14\
**Last updated:** [September 26, 2022, 5:24pm UTC](https://discourse.julialang.org/t/how-can-i-tell-julia-what-are-the-parameters-in-a-linear-model/87692 "2022-09-26T17:24:11Z")

</div>

Hi all! So, I’m experimenting with the linear regression ecosystem (GLM, Plots, DataFrames, StatsPlots and CSV). I understood how to produce a simple linear regression model and a multivariate one. I know that OLS work…

[Next page](https://discourse.julialang.org/tag/glm/351.md?match_all_tags=true&page=1&tags%5B%5D=glm)
