glm

Generalized Linear Model output through texreg

为君一笑 提交于 2021-02-19 06:15:48
问题 I can use texreg to get beautiful output of glm to be used for knitr . Sometimes we need to convert the output of glm back to response using inverse link. I wonder how to get inverse link output with texreg . Something like texreg(exp(glm.D93)) . counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) d.AD <- data.frame(treatment, outcome, counts) glm.D93 <- glm(counts ~ outcome + treatment, family = poisson()) library(texreg) texreg(glm.D93) which produces \begin

Generalized Linear Model output through texreg

余生长醉 提交于 2021-02-19 06:15:14
问题 I can use texreg to get beautiful output of glm to be used for knitr . Sometimes we need to convert the output of glm back to response using inverse link. I wonder how to get inverse link output with texreg . Something like texreg(exp(glm.D93)) . counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) d.AD <- data.frame(treatment, outcome, counts) glm.D93 <- glm(counts ~ outcome + treatment, family = poisson()) library(texreg) texreg(glm.D93) which produces \begin

Generalized Linear Model output through texreg

痞子三分冷 提交于 2021-02-19 06:15:09
问题 I can use texreg to get beautiful output of glm to be used for knitr . Sometimes we need to convert the output of glm back to response using inverse link. I wonder how to get inverse link output with texreg . Something like texreg(exp(glm.D93)) . counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) d.AD <- data.frame(treatment, outcome, counts) glm.D93 <- glm(counts ~ outcome + treatment, family = poisson()) library(texreg) texreg(glm.D93) which produces \begin

R: could not find function “function (object, …) \nobject” in glm() and bestglm()

 ̄綄美尐妖づ 提交于 2021-02-18 12:12:43
问题 I was running a bestglm analysis from the package bestglm : res.bestglm <- bestglm(Xy = offermodel, family = binomial, IC = "BIC", method = "exhaustive") summary(res.bestglm$BestModel) Morgan-Tatar search since family is non-gaussian. and I started getting this error: Error in model.frame.default(formula = y ~ 1, weights = weights, drop.unused.levels = TRUE) : could not find function "function (object, ...) \nobject" I inspected my model data and it looks good -- the right classes, no

Error during wrapup: long vectors not supported yet: in glm() function

倾然丶 夕夏残阳落幕 提交于 2021-02-11 16:42:44
问题 I found several questions on Stackoverflow regarding this topic (some of them without any answer) but nothing related (so far) with this error in regression. I'm, running a probit model in r with (I'm guessing) too many fixed effects (year and places): myprobit <- glm(factor(Y) ~ factor(T) + factor(X1) + factor(X2) + factor(X3) + factor(YEAR) + factor(PLACE), family = binomial(link = "probit"), data = DT) The PLACE variable has about 1000 unique values and YEAR 8 values. The dataset DT has 13

Offset specification in R

橙三吉。 提交于 2021-02-11 05:49:17
问题 Reading the description of glm in R it is not clear to me what the difference is between specifying a model offset in the formula, or using the offset argument. In my model I have a response y, that should be divided by an offset term w, and for simplicity lets assume we have the covariate x. I use log link. What is the difference between glm(log(y)~x+offset(-log(w))) and glm(log(y)~x,offset=-log(w)) 回答1: The two ways are identical. This can be seen in the documentation (the bold part): this

partykit - How to plot a glmtree without overlapping of terminal nodes?

我是研究僧i 提交于 2021-02-10 14:41:54
问题 I would like to plot a tree resulting from glmtree (partykit package). Unfortunately, the terminal nodes are overlapping and the labels of the graphs are no longer displayed properly. The code that generates the tree is this one: library(partykit) library(aVirtualTwins) data(sepsis) attach(sepsis) data <- cbind(y = survival, trt = as.factor(THERAPY), sepsis[,3:13]) formula <- as.formula(paste("y ~ trt", paste(names(sepsis[,3:13]), collapse = " + "), sep = " | ")) fit <- glmtree(formula, data,

Error when estimating CI for GLMM using confint()

寵の児 提交于 2021-02-10 13:27:31
问题 I have a set of GLMMs fitted with a binary response variable and a set of continuous variables, and I would like to get confidence intervals for each model. I've been using confint() function, at 95% and with the profile method, and it works without any problems if it is applied to a model with no interactions. However, when I apply confint() to a model with interactions (continuous*continuous), I've been getting this error: m1CI <- confint(m1, level=0.95, method="profile") Error in zeta

predict with glmer where new data is a Raster Stack of fixed efefcts

旧城冷巷雨未停 提交于 2021-02-08 11:59:30
问题 I have constructed models in glmer and would like to predict these on a rasterStack representing the fixed effects in my model. my glmer model is in the form of: m1<-glmer(Severity ~ x1 + x2 + x3 + (1 | Year) + (1 | Ecoregion), family=binomial( logit )) As you can see, I have random effects which I don't have as spatial layer - for example 'year'. Therefore the problem is really predicting glmer on rasterStacks when you don't have the random effects data random effects layers. If I use it out

best way to create response curves for a GLM species distribution model in R?

落爺英雄遲暮 提交于 2021-02-08 10:21:09
问题 I'm running a binomial GLM to predict the probability of a species occurrence, where I am training on one dataset and testing the model on another dataset: TrainingData<-read.csv("TrainingData.csv")[,-1] TrainingData[,1]<-as.factor(TrainingData[,1]) TrainingData[,4]<-as.factor(TrainingData[,4]) TestData<-read.csv("TestData.csv")[,-1] TestData[,1]<-as.factor(TestData[,1]) TestData[,4]<-as.factor(TestData[,4]) mod<-glm(presence~var1+var2+var3, family=binomial, data=TrainingData) probs=predict