2,008 questions
2
votes
1
answer
89
views
Multinomial Regression and non-functioning predicts()-function
I have to do some work in R for university and I'm stuck. When I use the predicts() function from the glm.predict package, I keep getting an error message that I don't understand. Codes that I get ...
0
votes
1
answer
51
views
Can I flip the axes in a sjPlot::plot_model(type = "est") plot?
I have a logistic regression model. The outcome is whether individuals voted for a certain party at time t. We have filtered the data so that only observations remain which have voted for this party ...
1
vote
0
answers
44
views
How to use glmulti in R when some variables have to be in all considered formulas?
I want to use glmulti to find the best model, but I want some variables (vb, vv) to be in all candidate models included. I have tried to extand the example from the R documentation with a factor vv ...
1
vote
1
answer
171
views
Error “could not find function 'dposnegbin2'” when using posnegbinomial() in vglm() from VGAM
I'm trying to fit a zero-truncated negative binomial model using the vglm() function from the VGAM package in R. However, I'm encountering the following error:
> dat <- read.dta("https://...
0
votes
1
answer
75
views
Issue with home-made forest plot in R ggplot2
I'm creating a forest plot for my logistic regression model in R. I am not happy with the forest plot created by some packages, especially because the names of the predictors and the levels of the ...
4
votes
1
answer
74
views
Calculation of Accuracy ratio for Logistic regression
I have fitted a Logistic Regression using a dummy data as below,
set.seed(1)
binary <- sample(c(1,0), 9, replace = T)
outcome <- rnorm(9)
treatment <- rnorm(9)
glm_fit <- glm(binary ~ ...
1
vote
1
answer
100
views
AME with Survey weights
I'm trying to calculate average marginal effects (AMEs) from a logistic regression model estimated with svyglm from the survey package.
I am using the design from a specialised package developed to ...
3
votes
2
answers
307
views
Non standard evaluation in formula argument
Problem
I would like to fit multiple logistic regression models in R for different values of i:
glm(mpg_20 ~ poly(horsepower, i), data = Auto)
My problem is that the call argument of the resulting ...
0
votes
0
answers
111
views
problem with glmmTMB with a matern for spatial autocorrelation
I have a dataset of bird counts, on a spatial grid, with environmental and prey data.
I have applied a correction factor for distance from observers, so I have semi-continuous values, with lots of 0's ...
11
votes
2
answers
410
views
Extracting model coefficients for formula terms
If I fit an lm or glm with factors as explanatory variables, I get a model with estimates and SEs for each level of the factor (minus the baseline level). How can I reliably extract that info for ...
0
votes
0
answers
23
views
Error in Y %*% Q01 : non-conformable arguments using Zicoseq in GUnifrac?
I'm trying to use Zicoseq on my data set and run into these non-conformable arguments. I've made sure that my originating matrices have the equal amount of rows (16), and that the columns look the ...
0
votes
0
answers
77
views
clustered standard errors in R clogit
I am using the clogit command in R, however I am not able to cluster the standard errors by districts using the method = "exact". It works with method = "error" but it gives me ...
0
votes
0
answers
38
views
Get continuous predictor values from a probit glmer() model in R?
I am running a binomial probit model in R. Condition is a categorical variable with value Target as the treatment group (index is 10). pPrime is continuous between 0 and 1. TC_c is continuous. ...
0
votes
0
answers
28
views
Model selection : how to deal with fixed and random effects in the same time?
I am studying the effect of various ecological variables on different plant species. I want to use GLM(M), but I am not very familiar with this approach.
After a preliminary correlation analysis and ...
3
votes
2
answers
93
views
Variable names and Easystats reports
I am trying to fit a very simple logistic regression model on a data, and then try and get an easystats text report:
library(tidyverse)
library(easystats)
Data <- structure(list(`...
1
vote
0
answers
74
views
How to display confidence intervals of bootstrapping GLM results for each factor?
tl;dr: I bootstrapped a generalized linear model. I would like to see the confidence interval for each factor instead of the CIs of reference levels.
I ran a generalized linear model. My dependent ...
0
votes
0
answers
48
views
Use of glm with ri2
I am conducting a randomisation inference procedure with ri2 for a binary model. I use glm and specify as a family binomial (link = 'logit'). When I use the ri2 on this model apparently it is not ...
1
vote
1
answer
407
views
Offsets in predict.glm(), given that the fitted poisson model already considered offsets - R
I want to predict a fitted poisson glm on newdata, given that it was fitted using offset=log(Exposure), but I get confused with the inclusion of the term "offset" inside of predict.glm(). I ...
0
votes
1
answer
178
views
Dredged many global models in R (binomial GLMs), how can I compare results across models?
I'm conducting data exploration on lots of parameters (including multiple ways to summarize a parameter). I'm trying to prioritize variables for prediction onto test data. I'd like to use dredge to ...
0
votes
1
answer
65
views
How to get coefficients from glm model in python
I have trained the following glm model in Python:
fitGlm = smf.glm( listOfInModelFeatures,
family=sm.families.Binomial(),data=train, freq_weights = train['model_weight']).fit()
I have ...
0
votes
0
answers
43
views
Understanding statistical significance
I have 16 birds (191978,191984, 191977, 191980, 191986, 201446, 191983, 201447, 211598, 211590, 211595, 191981, 211591, 201441, 201445, 211592). There are 6 males and 10 females. The dataset is called ...
0
votes
0
answers
47
views
How to select a reference level for categorical variables using Scikit-Learn?
I'm trying to convert a code from SAS to Python which trains a GLM. For that, I'm using the hpgenselect with the CLASS word to deal with categorical variables. In SAS I can select the reference level ...
0
votes
0
answers
29
views
I need help to debug my Zeroinfl GLM that causes an error indicating 'NA' and "exactly singular systems"
I am having a problem with my code. I am trying to create a GLM model with Zeroinfl since my data set has many 0's in it. I am trying to study the influence of pond characteristics on pond amphibian ...
-1
votes
1
answer
78
views
how can I quickly run multiple glm for different categories within my data?
i have a df that contains data for the nation and would like to see if the relationship between variables is different at smaller geographies (region, state).
i have tried using the subset argument of ...
0
votes
0
answers
52
views
Difference in estimates of SE between R's GLM and Python's minimize method
I have below dataset in R
dat = structure(list(PurchasedProb = c(0.37212389963679, 0.572853363351896,
0.908207789994776, 0.201681931037456, 0.898389684967697, 0.944675268605351,
0.660797792486846, 0....
0
votes
0
answers
137
views
Using GEE with "geepack" for survey data that includes time-fixed covariates
I want to use Generalized Estimating Equations (GEE) to model longitudinal survey data. Participants' responses were recorded at three timepoints, and I have multiple independent variables (which are ...
0
votes
1
answer
77
views
Recovering `init.theta` from `glm.nb()`
glm.nb() automatically calculates an init.theta when it is not user specified.
I cannot however seem to recover the user specified init.theta. When querying the model object, I obtain init.theta as 5....
0
votes
1
answer
53
views
Issue with including a quadratic term into a GLM quasi-poisson
I am currently looking at country-wide population ‘censuses’ that were conducted by feeding vultures at
all restaurant sites simultaneously. Simultaneous census counts were conducted twice in June
...
0
votes
1
answer
97
views
x@presence error for Species Distribution modeling [closed]
Does anybody know how to solve this problem?
I'm trying to build a species Distribution model using bioclimatic variables
sdm package by Naimi, 2016
R version 4.4.1
ERROR:
model <- sdm(Species ~ ., ...
1
vote
0
answers
74
views
Error in using mlogit function: "replacement has 8 rows, data has 9"
I am trying to estimate a simple multinomial logit model. The utility of a product is given by:
U_{ij}=\beta⋅price_{ij}+fixed_effect_j+ϵ_{ij}.
I have data which contains the choices made by ...
1
vote
0
answers
97
views
EdgeR DGE Matrix: Help Understanding Comparison / Contrast
I'm doing some differential expression analysis between two conditions (= Timepoint) and I'm including biological covariates in my design. I want to analyse further if differences between Timepoint ...
1
vote
1
answer
66
views
Zero-inflated negbin regression warnings after permutation of data
I am applying a zeroinfl negbin regression to my data. Specifically, my dependent variable is a count variable (centrality measure), while my independent/controls are both binary and continous.
I've ...
0
votes
1
answer
188
views
How to calculate and code confidence intervals for marginal predictions in GLM.jl/Effects.jl?
I am seeking assistance in how to calculate and write the code to produce 95% confidence intervals for the marginal predictions produced by Effects.jl for a fitted logistic regression model (e.g. ...
0
votes
1
answer
1k
views
How can I solve this problem in ChatGLM-6b? AttributeError: 'ChatGLMTokenizer' object has no attribute 'sp_tokenizer'
The default program from "https://github.com/THUDM/ChatGLM-6B" works out while I was running api.py.
But recently when I try to run it again it suddenly errors:"AttributeError: '...
1
vote
0
answers
314
views
What GLM family and link I should use for the left skewed dependent variable?
From what I read, the Generalized Linear Model (GLM) is flexible in accommodating a variety of error distributions. To effectively utilize GLM, it is important to select an appropriate family and link ...
2
votes
1
answer
273
views
Fitting a logistic model with multiple dependent vars/LHS
Is there a way to do multivariate logistic regression using glm()? I have several binary outcomes and I know you can do this with linear regression (lm()) and cbind() but I can't seem to figure out ...
0
votes
3
answers
112
views
Coefficients in each step of stepwise regression
I am using a stepwise regression in R, with this code:
model_scicareer_all <- glm(scicareer ~ .,
family = binomial(link = "logit"), data = clean_data)
summary(...
2
votes
1
answer
508
views
How to bootstrap glm regression, estimate 95% confidence interval and plot it?
I am doing glm regression with a 0-1 distribution dataset. It's going well with ggplot2::geom_smooth; here is my code:
library(ggplot2)
set.seed(123)
df <- transform(data.frame(Conc=runif(200, ...
0
votes
0
answers
59
views
Visreg plot of glm object doesn't match glm values
I have the following DATA
And the following code that builds a binomial logistic regression model, wherein all variables are factors:
#setwd("wherever you downloaded the file")
data_ev <- ...
-2
votes
1
answer
120
views
How can be the `$ operator is invalid for atomic vectors` error solved?
I'm trying to perform a CAPM regression analysis with a Bayesian GLM. I have developed the R code below but when I try to fit the model for the posterior predictive checks posterior_intercept <- ...
1
vote
1
answer
313
views
Error when trying to fit glmer in R with Poisson distribution: PIRLS step-halvings failed to reduce deviance in pwrssUpdate
The models I'm running won't converge / show an error. Do you have any advice about working with non-normal focal data? Most of the data are zero inflated or highly skewed.
The model I want to run is ...
1
vote
1
answer
291
views
How to extract Correlation of Coefficients table from models like glm?
After running a statistical model in R (e.g., glm, lm, lme4::lmer, etc.), I run the summary() command with corr=TRUE to get the Correlation of Coefficients table. It features a matrix of correlations ...
-1
votes
1
answer
274
views
How to force lm() and glm() functions not to refactor weights for linear regression?
I just want to run lm() and glm() for linear regression without refactoring weights, i.e., to utilize the weights just as they are specified. How can I do that?
It is known, but not documented, that ...
1
vote
0
answers
110
views
GLM Error in R - Getting the message: "Error: no valid set of coefficients has been found: please supply starting values"
I am trying to assign a poisson distribution to the random component of a GLM in R, however I keep getting the message "Error: no valid set of coefficients has been found: please supply starting ...
0
votes
0
answers
773
views
how do I fix this glmer error in r: PIRLS loop resulted in NaN value
I am trying to run a random effects generalized linear model specifying the family as binomial and a log link to estimate risk ratio (RR) and 95% confidence intervals (CIs). When I run it, I keep ...
1
vote
2
answers
209
views
How are computed linear predictors in R glm probit?
I would like to understand how linear.predictors are computed in the output of
pb = glm(formula, family = binomial( link = "probit" ), data)
From my understanding, it should be the product ...
0
votes
1
answer
90
views
Is there a way to reuse a glm fit, if all I have is the model fit call and summary?
I'm working from a project built by a previous programmer. The call to glm() the programmer has in their documentation is
glm(formula = AVAL ~ AUC, family = binomial(), data = logreg.dat)
I have the ...
1
vote
1
answer
377
views
How to display the exact p-values instead of < 0.001***?
I conducted a logistic regression and multiple comparison
library(lme4)
model < glmer(y ~ Genger + Age + subject +
(1 | ParticipantID), data = data, family = binomial(link = "logit"))
...
0
votes
0
answers
46
views
glm coefficient for the reference level
I need to know the coefficient of every level of a glm.
Call: glm(formula = Rep ~ ph_cat1, family = binomial(), data = db)
Coefficients:
(Intercept) ph_cat12 ph_cat13
3.296 -3....
0
votes
0
answers
431
views
How can I estimate Poisson quasi-MLE models in Python?
How do I estimate Poisson quasi maximum likelihood (MLE) models in python? Standard Poisson MLE assumes that the conditional mean of the variable equals its variance. Quasi-MLE permits relaxes this ...