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 back transform glm coefficients in order to plot results?

So I have a glm with two predictor variables, and one response, and I need to back transform the estimates so that when I add them to my plot they are on the same scale as my data. I have been told to make an object of the predicted values as…
user17088076
0
votes
1 answer

Is it possible to force a specific variable into bestglm?

My data set has 13 variables in total, and this is the glm I have currently. result2 = bestglm(training_set,IC = "AIC", family = binomial, method = "exhaustive") While this works fine and gives me the best model using the AIC criterion, the model…
0
votes
1 answer

How to efficiently run negative binomial regression with many variables in R

My dataset shows negative binomial distribution, therefore, I want to use negative binomial regression to analyze it. I followed the instruction described in this web site; https://stats.idre.ucla.edu/r/dae/negative-binomial-regression/ Actually, it…
0
votes
1 answer

How to set the dispersion parameter equal to one (phi=1) in Tweedie GLM using R Package

I want to fit a Tweedie GlM to a response variable but with a dispersion parameter (phi) set to 1 for all the records in my data. So all the parameters get estimated using Maximum Likelihood Estimator except for phi. Thank you.
Sara
  • 3
  • 2
0
votes
1 answer

Why does the drop1 function in R give me zero degrees of freedom and no significance test result for a continuous fixed effect in a GLM?

I am trying to determine the influence of five categorical and one continuous independent variable on some ecological count data using a GLM in R. Here is an example of what the data that I am using looks like: No. DateNum Tunnel Trt Row …
D.Hodgkiss
  • 25
  • 3
0
votes
0 answers

Fit loglinear model using lme4

I have a loglinear model that I know how to run using glm but I would like to know how to run it using lme4 Example dataset: library(MASS) UCBAdf <- as.data.frame(UCBAdmissions) Fit loglinear model using glm glmFitT <- glm(Freq ~ Admit * Dept *…
cliu
  • 933
  • 6
  • 13
0
votes
1 answer

How to find a turning point of quadratic term for different categories?

I have built a logistic regression with polynomial relationship with variable age, which I include in the model as an interaction with variable sex. I also have other independent and control variables. The main question is: How do I find a turning…
Saina V
  • 9
  • 4
0
votes
1 answer

Why are most of my residuals negative after logistic regression?

I have a dataset whereby the outcome variable is split into two groups (patients that had a side-effect or patients that did not). However, it's a bit uneven. (Those that did = 128 and those that did not = 1614). The results are as…
HKJ3
  • 387
  • 1
  • 10
0
votes
1 answer

Predicted glm() values do not match ggplot2 geom_smooth() plot

I am currently working on fitting a glm() on a dataset with a proportion variable (C3_proportion) along a continuous gradient (elevation) and I am trying to obtain the x values for y=c(0.25,0.5,1). After some research, it seems like a binomial glm…
0
votes
0 answers

geom_smooth does not seem to fit method="glm" with method.args correctly

I am trying to fit a glm line with geom_smooth but the fitting does not seem correct. I get a very straight line. I would expect a slight curve to the line of fit, since I am using 'generalized linear model' and not linear. Here is how my data…
user3508884
  • 75
  • 1
  • 1
  • 8
0
votes
1 answer

how to solve the glm problem when installing pymol?

I am trying to install pymol in CentOS 7 system. I installed the dependency glm-devel-0.9.6.3-1.el7.noarch by yum: sudo yum install glm-devel. During compiling I got an error related to glm as following: layer1/SceneView.cpp:34:61: error: no…
Yeping Sun
  • 405
  • 1
  • 6
  • 18
0
votes
1 answer

R Studio- Caret Package, commands not working

I have installed the Caret package in R Studio. I am using this package to split the data and eventually fit it into the model. The splitting of data code is below:- library(caret) set.seed(1234) trainIndex<- CreateDataPartition(y, times = 1, p =…
0
votes
0 answers

how do i solve this type of error " Calling var(x) on a factor x is defunct" when making a standar coefficient for a logistic regression?

Hi I was trying to use logistic regression in RSTUDIO about credit loan acceptance, I was doing the cleaning and of the data, but when I get to the last part of my code to make some predictions with the model and get the standard coefficients I get…
Mavezu94
  • 1
  • 2
0
votes
0 answers

How to perfom analysis in big tables in R

I am trying to see if the use of different habitats has an effect in the infestation level in a certain host population. Therefore, my dependent variable is Parasitation, with the value "0" if the individual wasn't parasitized and "1" if it was, and…
RBiology
  • 3
  • 3
0
votes
1 answer

Why does this specific sequence in the independent variable cause a bug in R GLM?

GLM shows the coefficient for "Yes" and "No", which is wrong. The GLM function usually automatically dummy codes binary factors so that only one of the levels has a coefficient. So in this case it should provide the coefficient for "Yes", while "No"…
CK7
  • 229
  • 1
  • 11