similar to: glm.nb

Displaying 20 results from an estimated 30000 matches similar to: "glm.nb"

2007 Aug 15
0
Negative Binomial: glm.nb
Hi Folks, I'm playing with glm.nb() in MASS. Reference: the negative binomial distribution P(y) = (Gamma(theta+y)/(Gamma(theta)*y!))*(p^theta)*(1-p)^y y = 0,1,2,... in the notation of the MASS book (section 7.4), where p = theta/(mu + theta) so (1-p) = mu/(mu + theta) where mu is the expected value of Y. It seems from ?glm.nb that an initial value of theta is either supplied, or
2004 Jun 15
1
AIC in glm.nb and glm(...family=negative.binomial(.))
Can anyone explain to me why the AIC values are so different when using glm.nb and glm with a negative.binomial family, from the MASS library? I'm using R 1.8.1 with Mac 0S 10.3.4. >library(MASS) > dfr <- data.frame(c=rnbinom(100,size=2,mu=rep(c(10,20,100,1000),rep(25,4))), + f=factor(rep(seq(1,4),rep(25,4)))) > AIC(nb1 <- glm.nb(c~f, data=dfr)) [1] 1047 >
2008 Apr 07
1
Anova function and glm.nb
Hi All, I am using the glm.nb function from the MASS package (current version) to fit and compare GLMs with negative binomial error distributions. My question is: what is the appropriate method to use in the anova function to compare models? If only one fitted object like m<-glm.nb(number<-p+sal+temp,data=data) is specified in the anova function (anova(m)), a fixed theta is used to
2009 Aug 13
2
glm.nb versus glm estimation of theta.
Hello, I have a question regarding estimation of the dispersion parameter (theta) for generalized linear models with the negative binomial error structure. As I understand, there are two main methods to fit glm's using the nb error structure in R: glm.nb() or glm() with the negative.binomial(theta) family. Both functions are implemented through the MASS library. Fitting the model using these
2004 Feb 02
1
glm.poisson.disp versus glm.nb
Dear list, This is a question about overdispersion and the ML estimates of the parameters returned by the glm.poisson.disp (L. Scrucca) and glm.nb (Venables and Ripley) functions. Both appear to assume a negative binomial distribution for the response variable. Paul and Banerjee (1998) developed C(alpha) tests for "interaction and main effects, in an unbalanced two-way layout of counts
2011 Jun 29
0
Problem: Update of glm-object cannot find where the data object is located
Hi everybody, I want to ask your help to explain what is going on with my following code: > mydata <- data.frame(y=rbinom(100, 1, 0.5), x1=rnorm(100), x2=rnorm(100)) > glm.fit.method <- function(model,data,...){glm(formula=model,data=data,family="binomial",. ..)} > fit1 <- glm(y ~ x1 + x2, data=mydata, family=binomial()) > update(fit1, .~1) Call: glm(formula =
2008 Sep 14
0
Question on glm.nb vs zeroinfl vs hurdle models
Good afternoon, I?m in need of an advice regarding a proper use of glm.nb, zeroinfl or hurdle with my dataframe. I can not provide a self-contained example, since I need an advice on this current dataset and its ?contradictory? results. So.... i have a dataset which contains 1309 cases and 11 variables, highly right-skewed and heavily zeroinflated (with over 1100 cases that have 0 value
2003 Mar 12
2
quasipoisson, glm.nb and AIC values
Dear R users, I am having problems trying to fit quasipoisson and negative binomials glm. My data set contains abundance (counts) of a species under different management regimens. First, I tried to fit a poisson glm: > summary(model.p<-glm(abund~mgmtcat,poisson)) Call: glm(formula = abund ~ mgmtcat, family = poisson) . . . (Dispersion parameter
2011 Feb 10
2
Comparison of glm.nb and negbin from the package aod
I have fitted the faults.data to glm.nb and to the function negbin from the package aod. The output of both is the following: summary(glm.nb(n~ll, data=faults)) Call: glm.nb(formula = n ~ ll, data = faults, init.theta = 8.667407437, link = log) Deviance Residuals: Min 1Q Median 3Q Max -2.0470 -0.7815 -0.1723 0.4275 2.0896 Coefficients:
2001 May 16
0
glm.nb difficulties
I'm having problems (or to be precise a student is having problems, which I'm having problems helping her with) trying to use glm.nb() from the MASS package to do some negative binomial fits on a data set that is, admittedly, wildly overdispersed (some zeros and some numbers in the hundreds). glm.nb is failing to converge, and furthermore is (to my surprise) producing values of theta
2008 Apr 21
1
estimate of overdispersion with glm.nb
Dear R users, I am trying to fully understand the difference between estimating overdispersion with glm.nb() from MASS compared to glm(..., family = quasipoisson). It seems that (i) the coefficient estimates are different and also (ii) the summary() method for glm.nb suggests that overdispersion is taken to be one: "Dispersion parameter for Negative Binomial(0.9695) family taken to be
2009 Mar 22
1
Multiple Comparisons for (multicomp - glht) for glm negative binomial (glm.nb)
Hi I have some experimental data where I have counts of the number of insects collected to different trap types rotated through 5 different location (variable -location), 4 different chemical attractants [A, B, C, D] were applied to the traps (variable - semio) and all were trialled at two different CO2 release rates [1, 2] (variable CO2) I also have a selection of continuous variables
2011 Nov 18
0
NB and poisson glm models: three issues
Hi, I fit both Poisson and NB (negative binomial) models to some empirical data. Although models provide me with sensible parameters, in the case of the NB models i get three inconsistencites: - First, the total number of occurrences predicted by the model (i.e. fitted(fit)) is much greater than those of the data. I realise that poisson and NB models are different in the sense that
2004 May 01
0
glm.nb and anova
Hi, I am trying to fit a negative binomial model with a number of parasite tapeworms as response variable to geographical coordinates (actually preparing a trend surface before kriging). When I try an anova, I get warnings: > glm4.nb<-glm.nb(wb~X4+Y4+I(X4^2)+I(Y4^2)) > anova(glm4.nb) Analysis of Deviance Table Model: Negative Binomial(0.0463), link: log Response: wb Terms added
2003 Jul 17
0
glm.nb
I am trying to fit the generalised linear model for the negative binomial, but the results which come out are attached below. When we fit this model using few covariates, the model converge. Does it mean that this family is fitted differently from other glm? or the number of zeros in my response variable has a limiting factor? Thanks Bruno fit <- glm.nb(pfde~SEX+...., data=data1) Warning
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]]
2010 May 03
2
Estimating theta for negative binomial model
Dear List, I am trying to do model averaging for a negative binomial model using the package AICcmodavg. I need to use glm() since the package does not accept glm.nb() models. I can get glm() to work if I first run glm.nb and take theta from that model, but is there a simpler way to estimate theta for the glm model? The two models are: mod.nb<-glm.nb(mantas~site,data=mydata)
2006 Jun 30
2
Passing arguments to glm()
Hi there I want to pass arguments (i.e. the response variable and the subset argument) in a self-made function to glm. Here is one way I can do this: f.myglm <- function(y,subfact,subval) { glm(d.mydata[,y]~d.mydata[,'x1'],family=binomial,subset=d.mydata[,subfact]==subval) } > str(d.mydata) `data.frame': 15806 obs. of 3 variables: $ y : Factor w/ 2 levels
2006 Aug 23
1
glm inside one self-defined function
Hi list, I've searched in R-help and found some related discussions but still could not understand this type of error. My own function is pretty complex, so I would not put it here, but the basic algorithm is like this: myfun<-function(k){ mydata<-...#by someway I create a data frame mymodel<-glm(y~.,family=binomial(),data=mydata) ...#some other stuff } as I execute this
2012 Jul 06
2
Graph showing fitted values obtained by binomial GLM
I have completed a binomial GLM in R (details attached (finalModel.docx)) and I am trying to create a graph of observed and fitted values using the following commands: > MyData<-data.frame(time=seq(from=0,to=1323,by=1)) > Pred<-predict(M2,newdata=MyData,type="response") > plot(x=turtle$time,y=turtle$success) > lines(MyData$time,Pred) However, I get the following