search for: glm2

Displaying 20 results from an estimated 28 matches for "glm2".

Did you mean: glm
2018 May 10
1
Tackling of convergence issues in gamlss vs glm2
Hello: I'd like to know how and if the GLM convergence problems are addressed in gamlss. For simplicity, let's focus on Normal and Negative Binomial with log link. The convergence issues of the glm() function were alleviated in 2011 when glm2 package was released. Package gamlss was released in 2012, so it might still use the glm-like solution or call glm() directly. Is that the case or the improvements from glm2 have been incorporated into gamlss also? Regards, Nik
2009 Feb 16
1
Overdispersion with binomial distribution
...s of freedom Residual deviance: 1323.5 on 104 degrees of freedom (3 observations deleted due to missingness) AIC: 1585.2 Number of Fisher Scoring iterations: 5 #### the output for residual deviance and df does not change even when I use quasibinomial, is this ok? ##### library(MASS) > glm2<-glm(y~Pred,"quasibinomial") > summary(glm2) Call: glm(formula = y ~ Pred, family = "quasibinomial") Deviance Residuals: Min 1Q Median 3Q Max -9.1022 -2.7899 -0.4781 2.6058 8.4852 Coefficients: Estimate Std. Error t value Pr(>...
2004 Aug 19
1
The 'test.terms' argument in 'regTermTest' in package 'survey'
.../ Windows 2000 / P4/2.8 Ghz Z <- as.factor(rep(LETTERS[1:3],20)) Y <- rep(0:1, 30) X <- rnorm(60) glm1 <- glm(Y ~ Z + X + Z:X, family=binomial) summary(glm1)$coeff regTermTest( model=glm1 , test.terms=~Z:X) ZB <- ifelse(Z=="B",1,0) ZC <- ifelse(Z=="C",1,0) glm2 <- glm(Y ~ ZB + ZC + X + ZB:X + ZC:X, family=binomial) summary(glm2)$coeff ## Okay, same as glm1 regTermTest( model=glm2 , test.terms= c("ZB:X","ZC:X")) regTermTest( model=glm2 , test.terms= ~ ZB:X + ZC:X)
2008 Nov 19
1
F-Tests in generalized linear mixed models (GLMM)
...> anova(glmm2$lme, glmm1$lme) Model df AIC BIC logLik Test L.Ratio p-value glmm2$lme 1 3 4340.060 4351.172 -2167.030 glmm1$lme 2 5 4292.517 4311.036 -2141.258 1 vs 2 51.54367 <.0001 > > # a linear model also works, though no p-value is reported > glm1 <- gam(y ~ x1 + x2) > glm2 <- gam(y ~ 1) > anova(glm1) Family: gaussian Link function: identity Formula: y ~ x1 + x2 Parametric Terms: df F p-value x1 1 45.58 7.69e-11 x2 1 13.96 0.000224 > anova(glm2, glm1) Analysis of Deviance Table Model 1: y ~ 1 Model 2: y ~ x1 + x2 Resid. Df Resid. Dev Df Deviance 1 299...
2006 Aug 31
1
NaN when using dffits, stemming from lm.influence call
...I start digging further, can anyone see why dffits might be failing? Is there a problem with the data? Consider: # Load data dep <- read.table("http://www.sci.usq.edu.au/staff/dunn/Datasets/Books/Hand/Hand-R/factor1-R.dat", header=TRUE) attach(dep) dep # Fit Poisson glm dep.glm2 <- glm( Counts ~ factor(Depression) + factor(SLE) + factor(Children) + factor(Depression):factor(SLE), family=poisson( link=log) ) # Compute dffits dffits( dep.glm2 ) This produces the output: 1 2 3 4 5 6 1.4207746 -0.1513808...
2008 May 08
2
poisson regression with robust error variance ('eyestudy
...: 174.54 # Number of Fisher Scoring iterations: 5 # > sqrt(diag(vcovHC(glm1, type="HC0"))) # (Intercept) carrot0 # 0.1673655 0.1971117 # > ### Compare against ## http://www.ats.ucla.edu/stat/stata/faq/relative_risk.htm ## robust standard errors are: ## .1682086 .1981048 glm2 <- glm(lenses~carrot0 +gender1 +latitude, data=dat, family=poisson(link=log)) sqrt(diag(vcovHC(glm2, type="HC0"))) ### Result: # > summary(glm2) #Call: # glm(formula = lenses ~ carrot0 + gender1 + latitude, family = poisson(link = log), # data = dat) # Deviance Residuals:...
2010 Oct 04
2
Plot for Binomial GLM
...12 60 M 16 4 13 10 F 3 17 14 10 M 1 19 15 20 F 2 18 16 20 M 2 18 17 30 F 10 10 18 30 M 8 12 19 40 F 14 6 20 40 M 12 8 21 50 F 16 4 22 50 M 13 7 23 60 F 18 2 24 60 M 16 4 glm2<-glm(deadalive~Dose*Sex,family=binomial,data=rat.toxic) > anova(glm2,test="Chi") Analysis of Deviance Table Model: binomial, link: logit Response: deadalive Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev P(>|Chi|) NULL...
2004 Sep 20
1
Using eval() more efficiently?
...NOD NOD 1 2 NOD NOD F1 F1 NOD F1 1 3 NOD NOD F1 F1 NOD NOD 1 4 NOD F1 NOD NOD NOD NOD 1 5 NOD F1 F1 F1 NOD F1 1 If I want to use the information from names.select to fit a glm() on Cross, I can do something like: > one.glm2 <- glm(eval(substitute(Cross ~ x1 + x2 + x3 + x4, + list(x1 = as.name(names.select[1]), + x2 = as.name(names.select[2]), + x3 = as.name(names.select[3]), +...
2008 Oct 10
1
Coefficients in a polynomial glm with family poisson/binomial
...ing offset), and have resorted to re-estimating them by running a second polynomial (lm() this time) on the predicted values from predict() of the glm. This is clearly not a nice way of doing things. Could anyone please inform me of why this is happening and of a better way around this? Code: glm2<-glm(FEDSTATUS1~AGE+I(AGE^2), family=binomial(link="probit")) summary(glm2) ### first set of "wrong coefficients" nd1<-expand.grid(AGE=c(1:70)) Pred.Fed1<-predict(glm2,nd1,type="response") points(predict(glm2,nd1,type="response")~nd1$AGE, col=2) A...
2011 Sep 21
1
Problem with predict and lines in plotting binomial glm
..., 4, 9, 6, 9, 4, 7, 7, 6, 4, 8, 8, 9, 5, 8, 11, 13, 13, 3, 5, 7, 11, 11, 8, 6, 12, 11, 4, 13, 11, 6, 9, 12, 12, 7, 14, 4, 9, 11, 13, 11, 12, 16, 6, 13, 17, 17, 11, 8, 12, 16, 14) y <- cbind(successes, failures) data <- data.frame(y, x) glm1 <- glm(y ~ x, family= quasibinomial, data= data) glm2 <- glm(y ~ log(x), family=quasibinomial, data= data) # residual deviance is lower with log transformed x-value plot(x, successes) lines(x, predict(glm1, type= "response"), lwd=2) Firstly, because of the skewed distribution of the x variable I am not sure whether it should be lo...
2002 Apr 30
1
MemoryProblem in R-1.4.1
...f samples simulated [1] 1000 >class(list.glm[[324]]) #any component of the list [1] "glm" "lm" >length(list.glm[[290]]$y) #sample size [1] 1000 Because length(list.glm) and the sample size are rather large, I've splitted the list into 10 sub-list, say: list.glm1, list.glm2,.... Now I'm using of course: out1<-lapply(list.glm1, myfun) out2<-lapply(list.glm2, myfun) .... However only the first works, for the second one it is: Error: cannot allocate vector of size 3 Kb In addition: Warning message: Reached total allocation of 255Mb: see help(memory.size) So I...
2007 Feb 14
1
how to report logistic regression results
...far as I understand Baron and Li describe how to do this, but my question is now: how do I report this in an article? Can anyone recommend a particular article that shows a concrete example of how the results from te following simple modeling can be reported: glm1 = glm(DV ~ A, family = binomial) glm2 = glm(DV ~ A + B, family = binomial) anova(glm1, glm2, test = "Chisq") Any help on how this simple kind of modeling should be reported is appreciated. Greetings, Edwin Commandeur [[alternative HTML version deleted]]
2010 Jun 03
1
compare results of glms
...! i have run several glm analysises to estimate a mean rate of dung decay for independent trials. i would like to compare these results statistically but can't find any solution. the glm calls are: dung.glm1<-glm(STATE~DAYS, data=o_cov, family="binomial(link="logit")) dung.glm2<-glm(STATE~DAYS, data=o_cov_T12, family="binomial(link="logit")) as all the trials have different sample sizes (around 20 each), anova(dung.glm1, dung.glm2) is not applicable. has anyone an idea? thanks in advance! ps: my advisor urges me to use the z-test (the common test sta...
2004 May 07
1
contrasts in a type III anova
...the argument "coeff". The two factors are Y (Ya, Yb,..., Ye) and Auto (Auto1, Auto2,...., Auto10) The responses are binomial (counts in the matrice "mat") and gaussian (variable "tot"). I use the glm procedure : glm1 <- glm (mat ~ y*auto, data, family=binomial) glm2 <- glm (tot ~ y*auto, data, family=gaussian) Subsequently I use the Type III anova : Anova (glm1, type="III") Anova (glm2, type="III") Using the contrast.treatment for both factors Y and Auto, R gives coherent results, but I really not sure that this contrasts are appropr...
2002 May 16
1
glm(y ~ -1 + c, "binomial") question
...R (3rd Ed. Ch7) and Chambers & Hastie (1993) were very helpful but I wasn't sure I got all the answers. In a simplistic example suppose I want to explore how disability (3 levels, profound, severe, and mild) affects the dichotomized outcome. The glm1 model (see below) is the same as glm2 (2 dummy variables coding sever and mild). In both models the reference level is profound disability. My questions are: 1. How do I interpret the coefficients in the third model (the intercept is removed)? 2. Does glm3 make sense? Does anyone ever want to construct a model like glm3? If...
2006 Aug 27
1
refer to objects with sequential names
Dear Listers, If I have several glm objects with names glm1, glm2.... and want to apply new data to these objects. Instead of typing "predict(glm1, newdata)..." 100 times, is there way I could do so in a loop? Thank you so much! wensui [[alternative HTML version deleted]]
2008 Feb 19
1
Referencing to an object within a function
...Any assistance would be greatly appreciated. The function is as follows: > colonization <- function(x,y){ library(segmented) col <- subset(final,final[,x] == 2 | final[,x] == 4) col[,x] <- ifelse(col[,x] == 2,1,0) glm1 <- glm(col[,x]~col[,"PLAND"],family=binomial) glm2 <- segmented.glm(obj = glm1, seg.Z = ~PLAND, psi=y, it.max = 100) } > colonization("PIWO",48) Error in eval(expr, envir, enclos) : object "x" not found Thank you.
2002 Jan 02
0
comparative rendering of modeling outputs
...cremo.html This package addresses the problem of assembling and rendering results of multiple linear model fits in formats suitable for presentation in applications contexts. An extract from the output of 'example(cremo)': cremo> data(stackloss) cremo> attach(stackloss) cremo> glm2 <- glm(stack.loss ~ Air.Flow + Water.Temp + Acid.Conc.) cremo> glm3 <- glm(stack.loss ~ Air.Flow + Water.Temp) cremo> glm4 <- glm(stack.loss ~ Air.Flow * Water.Temp) cremo> try(print(cremo(list(glm2, glm3, glm4), adeqel = c("deviance", "aic")), quote =...
2005 Aug 04
0
add1.lm and add1.glm not handling weights and offsets properly (PR#8049)
...hts = rep(1, 10)) add1(lm0, scope = ~ x) ## works ok add1(lm1, scope = ~ x) ## error lm2 <- lm(y ~ 1, offset = 1:10) add1(lm0, scope = ~ z) ## works ok add1(lm2, scope = ~ z) ## gives incorrect results (ignores the offset) glm0 <- glm(y ~ 1) glm1 <- glm(y ~ 1, weights = rep(1, 10)) glm2 <- glm(y ~ 1, offset = rep(0, 10)) add1(glm0, scope = ~ x) ## error add1(glm1, scope = ~ x) ## error add1(glm2, scope = ~ x) ## error As I see it, the two problems are: 1. add1.lm ignores any offset present in its "object" argument. 2. add1.lm and add1.glm both take weights...
2012 Aug 10
1
plotting profile likelihood curves
...interpreting the theory behind this. Thanks for any help you can give. Max clotting <- data.frame( + u = c(5,10,15,20,30,40,60,80,100), + lot1 = c(118,58,42,35,27,25,21,19,18), + lot2 = c(69,35,26,21,18,16,13,12,12)) glm(lot2 ~ log(u), data=clotting, family=Gamma) prof<-profile(glm2) plot(prof) [[alternative HTML version deleted]]