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

inconsistency between the coefficient of zero-inflated negative binomial and glm in R

As far as I know, ZINB has two parts: zero-inflation portion and count portion. I think the zero-inflation part is similar to glm and the second one is more related to negative binomial. Therefore, I expect that the coefficients of the…
Elnaz
  • 111
  • 2
  • 6
0
votes
1 answer

Is there a way to perform multivariate glm in R (Multiple DV and Multiple IV)?

I am fairly new to R and I want to do multivariate and univariate analysis of my dataset Dataset example: I have 32 dependent variables and 4 Independent variables all arranged in columns. I want to do multivariate analysis that tells me which of…
RRookie
  • 11
  • 4
0
votes
1 answer

Difference in output between predict.rpart and predict.glm

I split a dataset up in a training and test sample. I then fit a logit model on the training data to predict the outcome of the test sample. I can do this in two ways: Using Tidyverse: logit_mod <- logistic_reg() %>% set_mode("classification") %>%…
JKuhn
  • 3
  • 2
0
votes
0 answers

GLM Model adressing variables

in my GLM model I tested for not significant variables. One of variable in Geography where values woould be country names. So test showed me that variable GeographyCountryA is significant so I want to keep it but not sure how to properly address it…
0
votes
0 answers

ValueError: NaN, inf or invalid value detected in endog, estimation infeasible. in GLM model

I am using statsmodel GLM for linear prediction. This is the code that I set exog and endog X_train = claim_data_x.iloc[:,5:].values Y_train = claim_data_x.loc[:,'LOSS_AMOUNT'].values num_claims = claim_data_x.loc[:,'CLAIM_FREQ'].values X_test =…
Josh
  • 1
  • 1
0
votes
0 answers

How to make an effect plot for GLM model with ggplot?

I have a generalized linear model (family - gamma) with interaction, and need to plot it specifically in ggplot2 (on a response scale). The model was constructed with following code: fit1mult = glm(SIZE_OOCYTE ~ TREATMENT * CASTE, …
0
votes
0 answers

How to perform spatial-autocorrelation test on mixed-effect model?

In my data frame I have my observations in blocks of time so in order to take the effect of year I decided to works with mixed effect model by specifying the year of sampling as random effect. This is a simple example of how I proceeded : modele <-…
user1988
  • 29
  • 1
  • 7
0
votes
1 answer

How to make a double loop for glm, using two data frames (one for dependent and another for independent variables)?

I feel that I am just little bit off with my code but cannot figure out how to make it work. I am trying to use all the columns in one data frame as an independent variable and all the columns in another as dependent (to run multiple single variable…
0
votes
1 answer

Fitting a probit model to 200 observations of 3 standard normal covariates

Background and Task: Consider a random sample of size n with a binary outcome Y_i. Assume Y_i ~ Bern(pi_i). Assume the probit link function pi_i=Phi(X_i^T beta). Create an X matrix with 200 observations on three covariates, each with standard normal…
Vons
  • 3,277
  • 2
  • 16
  • 19
0
votes
1 answer

R glm.nb prediction for three variables returning error

I would like to find the predicted values from my glm.nb model. But it is returning errors. This was not fixed when I made the input dataframe to predict 3 columns of dates called date, date2 and date3. The output I want is a vector of 100…
0
votes
1 answer

Using terminal panels in plot() after glmtree()

Using the recursive partitioning model for logit-trees in the following manner library("partykit") glmtr <- glmtree(formula = y~t + 1 | (variables)^2, data = dff, minsize = 500, maxdepth=4, …
vog
  • 770
  • 5
  • 11
0
votes
1 answer

h2o GLM R Dipersion parameter

Is there a way to extract the dispersion parameter (also called phi) from an h2o.glm() object? In standard R this can va achieved by doing summary(glm_object)$dispersion Is it possible to achieve the same with an h2o.glm() object? Thank you
Marco De Virgilis
  • 982
  • 1
  • 9
  • 29
0
votes
0 answers

I've encountered this error message - Error in fetch(key) : cannot allocate memory block of size 3.2 Gb

I've used memory.limit() to enhance it to the 4GB limit that R has told me I have, but, I need to run ggPlot2 on the data I have which I'm unable to do so without more memory. Is this simply an issue with the RAM on my computer or is there a way…
LLLLFFFF
  • 3
  • 3
0
votes
1 answer

How do I select specific coeficients in R when I am trying to find out a perfect fit in R

I am lookig for an opinion. I am new to R and for work I am trying to create a tarif pricing structure using the following: exposition, zone vehicle and drivers age (both categorical I was able to create some groups based on the age), fuel and brand…
0
votes
1 answer

How to obtain confusion matrix using caret package?

I was trying to analyse example provided by caret package for confusionMatrix i.e. lvs <- c("normal", "abnormal") truth <- factor(rep(lvs, times = c(86, 258)), levels = rev(lvs)) pred <- factor( c( rep(lvs, times = c(54, 32)), …
John
  • 1,849
  • 2
  • 13
  • 23