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

Interaction term issue with Zero-Inflated Model in R

I have count data with a huge amount of excess zeros, so have been attempting to run a zero-inflated model with an interaction term ("*") between two independent variables. When I run the following code (where "abundance" is my count dependent…
Reece
  • 1
0
votes
1 answer

I am getting factor error while using glm function in R

I have a data like below, and trying to write a soccer prediction with R. Div Date HomeTeam AwayTeam FTHG FTAG FTR HTHG Length:2184 Length:2184 …
sanwhere
  • 23
  • 5
0
votes
2 answers

How to unlist glm summaries into date frames

Let's consider list of summaries: set.seed(42) bin_var <- sample(0:1, 125, T) indep_1 <- rnorm(125) indep_2 <- rexp(125) indep_3 <- runif(125) summary_list <- list(summary(glm(bin_var~indep_1)), summary(glm(bin_var~indep_2)), …
John
  • 1,849
  • 2
  • 13
  • 23
0
votes
0 answers

How I could fit a logistic regression of a SAS code in R?

I read the following article: MAYFIELD LOGISTIC REGRESSION: A PRACTICAL APPROACH FOR ANALYSIS OF NEST SURVIVAL and it offers a SAS code (below) to fit a logistic model: proc logistic data = {data set}; model FAIL/OBSDAYS = MIDHT SNAGBA …
0
votes
1 answer

sklearn GLM classificiation

Is there a way to implement a generalized linear model to classification problems in sklearn? Since there isn't a classification class for that I thought of applying a sigmoid function to regression results. Is there an easy way to do it with…
0
votes
1 answer

rstatix anova_test in R gives contrast error despite more than 2 levels

The following is subset of my data set: structure(list(ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L), .Label = c("5356", "5357",…
CanyonView
  • 401
  • 3
  • 15
0
votes
0 answers

How does the weights argument in glm work in R?

I'm really puzzled by the weighting argument in glm. I realise that this question has been asked before but Im still confused about what the weights argument does or how it works. For example, in the code below my dependant variable PCL_Sum2 is…
Socsi2
  • 33
  • 3
0
votes
1 answer

How to do 10-nearest neighbour propensity score matching? I only seem to found 1-1 nearest neighbour matching online

#1:1 nearest neighbour mod_match_one <- matchit(treatment ~ variable1 + variable2 + variable3, method = "nearest", data = trial_fixed, distance = "glm") #is this correct if I am told to find 10-nearest neighbour? mod_match_ten <- matchit(treatment…
Chie
  • 3
  • 1
0
votes
1 answer

R: The diferrence of estimate parameter between GLM model and optim() package

My purpose is to find estimate parameters with optim() package in R. And I compare my result with GLM model in R. The code is d <-…
0
votes
2 answers

R: Saving model output from for loop - list is blank

This is my first time posting here, so apologies in advance if there are any issues with my question or reproducible example. I've checked similar questions and their answers, but haven't been able to figure out where I'm going wrong here. I have a…
cm_kam
  • 3
  • 2
0
votes
1 answer

How to conduct parametric bootstrapping in R?

I am working with the orings data set in the faraway package in R. I have written the following grouped binomial model: orings_model <- glm(cbind(damage, 6-damage) ~ temp, family = binomial, data = orings) summary(orings_model) I then constructed…
w5698
  • 159
  • 7
0
votes
1 answer

Problems with MatchIt in R

When I run matchit function in MatchIt package using method = 'nearest' and distance = 'glm', I got the following error, glmnot supported. What does this mean?
ycenycute
  • 688
  • 4
  • 10
  • 20
0
votes
1 answer

Combine output files from Proc GLM in SAS

I am not sure if what I am trying to do is even possible, so I thought I would check with more experienced SAS users. I want to run Proc GLM many, many times using the "by" statement and then have output parameters for each run go into a single a…
Cae.rich
  • 171
  • 7
0
votes
1 answer

Make a loop on different family for glm in R

I'm trying my best but I can't find out how to loop on different laws, to find the best glm model! famille = paste0(fam,'(link=',sprintf(" '%s'",lien),')') famille [1] "poisson(link= 'log')" I got two variables fam and lien I want to loop on two…
0
votes
1 answer

Possible to determine if logistic regressions' sigmoid function (curve) is "reasonable" or not in R?

I had a question regarding the logistic regression function in R. I was wondering if there's a way to tell if the predicted curve from a glm will be reasonably shaped or not, e.g. a nice S-shaped curve opposed to a flattened curve/straight line? I'm…
polartex
  • 1
  • 1