Questions tagged [glm]

For questions relating to generalized linear models. For the GLM math library, see the [glm-math] tag.

Generalized linear models are a class that encompasses a variety of standard statistical models, including ordinary least squares (a.k.a. linear models, OLS) regression, probit, logistic regression, Poisson regression, and other methods that can be expressed in the standard GLM form.

Consider whether your question is better suited to Cross Validated, the Stack Exchange site for statistics and machine learning. Questions on Stack Overflow should be about programming issues arising from fitting models to data.

In scientific software for statistical computing and graphics, a GLM can be estimated by the function glm.

2019 questions
0
votes
0 answers

Combine two merModList objects (from a model run on two different mild objects created from a single dataset) into a single object for analysis

I am using the glmerModList() function from merTools to fit a generalized mixed model to 15 imputed datasets. I first turned the 15 datasets (each with about 322,000 rows) into a list (a mild object), by doing the following: imputed_dflist <-…
erin489
  • 35
  • 4
0
votes
0 answers

glm() error contrasts can be applied only to factors with 2 or more levels

I am creating a logistic regression model using some data set. Despite removing factors containing only one level I am still getting the error: > fit <- glm(Intraop_Blood_Products ~ ., family = binomial(), na.action = na.omit, data = rel_data) Error…
0
votes
1 answer

Change the levels of the categorical predictor in glm in R

I have a predictor variable called "Group", this group has 3 categories (ALTO, MEDIO, BAJO). In my glm for binomial family, the summary shows the intercept + BAJO and MEDIO, but I need to see in my tab_model only ALTO and MEDIO and let BAJO as…
AgusDam87
  • 97
  • 7
0
votes
1 answer

Extracting coefficients and p_values for different 1-factor logistic regression models in R

I have 7 1-factor logistic regression models that I have fitted using GLM (stored in model1 to model7). For each model, I want to extract their coefficient and store in "coeffs" vector well as the p-value to be stored in "p-values" vector. I tried…
yash471994
  • 63
  • 7
0
votes
1 answer

Replicating SAS GLIMMIX contrast statement in R

I am working with a collaborator who uses SAS, while I am more familiar with R. My collaborator has created a GLIMMIX Procedure Type III test of fixed effects with custom hypothesis tests (using a CONTRAST Statement). I have found a way to…
ZDinges
  • 53
  • 5
0
votes
2 answers

How do I filter on the name of the glm coefficient?

The following code df <- data.frame(place = c("South","South","North","East"), temperature = c(30,30,20,12), outlookfine=c(TRUE,TRUE,FALSE,FALSE) ) glm.fit <- glm(outlookfine ~ .,df , family=…
Kirsten
  • 15,730
  • 41
  • 179
  • 318
0
votes
0 answers

Why does glm prune a column?

When I run the following df <- data.frame(place = c("South","South","North"), temperature = c(30,30,20), outlookfine=c(TRUE,TRUE,FALSE) ) glm.fit <- glm(outlookfine ~ .,df,…
Kirsten
  • 15,730
  • 41
  • 179
  • 318
0
votes
1 answer

cv.glm variable lengths differ despite correct model formula

I am experiencing the same error as raised and answered here (cv.glm variable lengths differ) and in various other threads. Despite using the "correct" formula structure as suggested in all these threads, the error persists: mod <- glm(Y ~ Var_1,…
user303287
  • 131
  • 5
0
votes
1 answer

Error when adjusting a GLM: Error in eval(family$initialize)

I am trying to adjust a generalized linear model defined below: It must be noted that the response variable Var1, as well as the regressor variable Var2, have zero values, for which a constant has been added to avoid problems when applying the…
user55546
  • 37
  • 1
  • 15
0
votes
0 answers

How to assign a specific value of some binary V. as predictors in glm?

I want to fit a glm in R. The predictors I am using are let's say 4 variables: Age, Sex, HIV But I want to fit the glm in a way that it only uses those rows of HIV which are equal to 0 and those rows of DM which are equal to…
Aura
  • 49
  • 7
0
votes
1 answer

Differential expression analysis - switch intercept coefficient

I am trying to use edgeR for differential expression analysis of a biologial count dataset. My samples are split into case and controls and I would like to know the genes that are up or down regulated in case samples (i.e. those with the condition)…
A_Murphy
  • 184
  • 2
  • 14
0
votes
1 answer

How to add interaction term in GLM in python

I am able to run GLM with following syntax; y_train = dt_glm['Eligible Revenue'] x_train = dt_glm[['Upfront Contra','Distribution Inventory Eurofit Net USD','Upfront Contra','6U','BNB']] model_glm = sm.GLM(y_train , x_train,…
Ashish
  • 115
  • 3
  • 15
0
votes
1 answer

Why no t-scores or p-values from summary(glm) in Databricks?

I'm using Databricks with the SparkR package to build a glm model. Everything seems to run ok except when I run summary(lm1). Instead of getting Variable, Estimate, Std.Error, t-value & p-value (see pic below - this is what I'd expect to see, NOT…
screechOwl
  • 27,310
  • 61
  • 158
  • 267
0
votes
2 answers

R: Different result from glm and mle2 package in R

So I want to find the estimate parameter using GLM and compare it with mle2 package. Here's my code for GLM d <-…
0
votes
0 answers

Replacing values of a glm with bootstrapped values

I am using a bootstrap function (code below), which produces the following data-frame: df <- structure(c(-30.52, 0.3759, 0.2377, -0.05084, -0.07212, 0.01609, 14.73, 0.2081, 0.3742, 0.07192, 0.06808, 0.007358, -2.072, 1.806, 0.6354, -0.707, -1.059,…
Tom
  • 2,173
  • 1
  • 17
  • 44