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
1 answer

How to compute GLM for a model with two variables + fit to a log-likelihood function in R?

In an experiment, we had two types of treatments -- same species (x1.test at two densities 1000, 5000) or different species (x2.test at two densities 1000, 4000) for which we collected the total number of offspring (y.test) arranged as…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
0
votes
1 answer

How does the 'with' function work with glm model output?

I'm trying to understand the with function in context of a glm function output from here First, a simple data set set.seed(101) x.test <- runif(50,2,8) y.test <- 0.5^(x.test) df <- data.frame(x.test, y.test) I want to fit the function of form…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
0
votes
1 answer

TensorFlow Probability GLM tfp.glm for Multi-Class Classification

In the tutorial here the model specified for logistic (binary) regression is tfp.glm.Bernoulli(); how do we fit a model on a target with three or more classes in tfp.glm?
0
votes
1 answer

How to plot model glm result with a lot of parameters

I really need help with this. I want to make a predict model for my glm quasipoisson. I have a problems since i wrongly make a glm model with my dataset. I used to make a predict model based on my glm quasipoisson for all my parameters, but I ended…
0
votes
0 answers

Out of memory when fitting generalized linear model

I am trying to fit a GLM poisson model using a stepwise procedure (I am fully aware of the pitfalls of stepwise procedures - but at work my supervisor insisted on this approach). After fitting about 19 models I got the error message "Unable to…
lostwanderer
  • 143
  • 1
  • 1
  • 7
0
votes
1 answer

User-defined function to iterate through factor levels in a regression

I am a beginner in R so I'm sorry if my question is basic and has been answered somewhere else but unfortunately I could not find the answer. One of my predictor variables, nationality, has 8 levels. I want to create a user defined function that…
0
votes
1 answer

Is there method to deal with missing observation through adding weight in GLMM?

Is there method to deal with missing observation through adding weight in GLMM? I wonder how to construct a GLMM model with count data where some observations lost. For me, I used yellow sticky board to trap ladybeetles, whose data type is count.…
PeterPanPan
  • 151
  • 4
0
votes
0 answers

OptimalCutPoints for GLM (Logistic Regression) in R | Find the Threshold

I want to find a threshold value so I can classify which observation is classified to be sucess or not. But I am a confused about how to use the package for logistic regression. For example my glm model…
0
votes
1 answer

Weird plots when plotting logistic regression residuals vs predictor variables?

I have fitted a logistic regression for an outcome (a type of side effect - whether patients have this or not). The formula and results of this model is below: model <- glm(side_effect_G1 ~ age + bmi + surgerytype1 + surgerytype2 + surgerytype3 +…
HKJ3
  • 387
  • 1
  • 10
0
votes
1 answer

Find the parameter estimates for each random term in a binomial GLMM (lme4)?

Does anyone know how to extract the parameter estimates of random term when using the (1 | …) syntax in a glmer model (including se, t ratio and p value)? I’m only able to access the average variance and std. deviance with the summary function. Some…
andreafg
  • 1
  • 1
0
votes
2 answers

scoping/non-standard evaluation issue in `glm()`'s formula in a function in R

I have a function that computes a table and a model (and more...): fun <- function(x, y, formula = y ~ x, data = NULL) { out <- list() out$tab <- table(x, y) out$mod <- glm(formula = formula, family = binomial, …
Thomas
  • 457
  • 2
  • 12
0
votes
2 answers

checking normality of residuals

I am to test the normality of a set of residuals in a model glm(Failure ~ Lead ,data=Exercise2, family="binomial") summary(glm(Failure ~ Lead ,data=Exercise2, family="binomial")) hist(summary(glm(Failure ~ Lead ,data=Exercise2,…
kiely90
  • 21
  • 2
0
votes
1 answer

fitted values from speedglm() look very different from fitted values with glm()

The fitted values returned from speedglm() look really different from those returned from glm() and i don't know why. For example, if I run this: data("lalonde") glm <- glm(married ~ treat + age + educ + black + hisp + nodegr, data = lalonde, family…
C.Robin
  • 1,085
  • 1
  • 10
  • 23
0
votes
1 answer

Generalized Linear Model (GLM) in R

I have a response variable (A) which I transformed (logA) and predictor (B) from data (X) which are both continuous. How do I check the linearity between the two variables using Generalized Additive Model (GAM) in R. I use the following code model…
Tristan
  • 13
  • 4
0
votes
0 answers

Cannot get GLM because of 'unexpected symbol' input

Error: unexpected symbol in: "body.glm <- glm(Bodyfat ~ Density + Age + Weight + Height + Neck + Chest + Abdomen + Hip + Thigh + Knee + Ankle + Biceps + Forearm + Wrist)set.seed (3)" I am getting this when trying to get my GLM. I…