Displaying 20 results from an estimated 91 matches for "negbin".
2007 Dec 12
1
Defining the "random" term in function "negbin" of AOD package
I have tried glm.nb in the MASS package, but many models (I have 250 models
with different combinations of predictors for fish counts data) either fail
to converge or even diverge.
I'm attempting to use the negbin function in the AOD package, but am unsure
what to use for the "random" term, which is supposed to provide a right hand
formula for the overdispersion parameter. I'm not even sure what this
statement means. Any advice you have would be greatly appreciated.
negbin(formula, random,...
2009 Oct 15
2
When modeling with negbin from the aod package...
Hi,
When modeling with negbin from the aod package, parameters for a given count
y | lambda~Poisson(lambda)
with lambda following a Gamma distribution Gamma(r, theta)
are estimated.
The intercept is called phi.
Some other parameters may be also be estimated from factors in the
data: the estimates returned for all these would...
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...
2010 Feb 11
1
Zero-inflated Negat. Binom. model
...i.e. how well does chick size predict tape intensity?
Since I have a small sample size, I fit a zero inflated negat. Binomial (not
Poisson) model using the "pscl" package.
I built tried two models and got the outputs below.
> model <- zeroinfl(Int_Cesto ~ CAPI, dist = "negbin", EM = TRUE)
Call:
zeroinfl(formula = Int_Cesto ~ CAPI, dist = "negbin", EM = TRUE)
Count model coefficients (negbin with log link):
(Intercept) CAPI
-2.99182 0.06817
Theta = 0.4528
Zero-inflation model coefficients (binomial with logit link):
(Intercept)...
2011 Oct 26
2
gam predictions with negbin model
Hi,
I wonder if predict.gam is supposed to work with family=negbin()
definition? It seems to me that the values returned by type="response"
are far off the observed values. Here is an example output from the
negbin examples:
> set.seed(3)
> n<-400
> dat<-gamSim(1,n=n)
> g<-exp(dat$f/5)
> dat$y<-rnbinom(g,size=3,mu=g)...
2000 Mar 21
1
summary.negbin broken in R-1.0.0, VR_6.1-7
Dear R people,
I am not sure if this is the correct place to tell about problems in evolving
programmes, but it seems that the `summary.negbin' function of the excellent
`MASS' library is now broken, and gives the following error message:
> summary(hm)
Error in summary.negbin(hm) : subscript out of bounds
`summary.negbin' calls `summary.glm' which seems to work and give the desired
output like called there, but call...
2009 Dec 30
1
Fwd: Negbin Error Warnings
Dear Clara,
Thanks for the reply. I am forwarding your message to the list, ok.
When I wrote was a way of get further information to help the helpers.
happy holidays,
milton
---------- Forwarded message ----------
From: Clara Brück <clara_brueck@web.de>
Date: 2009/12/30
Subject: Re: [R] Negbin Error Warnings
To: milton ruser <milton.ruser@gmail.com>
Dear Milton,
Thanks for your email. I ran the NBR-model and then tried to compute the
first differences of some
expected values:
m3.x1 <-setx(m3, advisory=1)
m3.x2 <-setx(m3, advisory=0)
m3.s1 <-sim (m3,x=m3.x1, x1=m3.x2)...
2001 Sep 25
2
glm.nb, anova.negbin
Dear R-collegues,
I'm getting an error message (Error in round) when summarising a glm.nb
model, and when using anova.negbin (in R 1.3.1 for windows):
> m.nb <- glm.nb(tax ~ areal)
> m.bn
Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498,
link = log)
Coefficients:
(Intercept) areal
3.03146 0.03182
Degrees of Freedom: 283 Total (i.e. Null); 282 Residual
Null Deviance: 353...
2013 Mar 15
0
Poisson and negbin gamm in mgcv - overdispersion and theta
...rsion parameter from a (Poisson) gamm?
I have not been able to extract residual degrees of freedom from M1.
2) How to manually estimate theta for a negative binomial gamm?
I would like to see if applying a negative binomial distribution with log link (model below) would solve the problem. However, negbin in gamm requires a known theta...
M2 <- gamm(Resp ~ s(Day, k=8) + s(Day, by=C, k=8) + Flow + offset(LogVol),
data=MyResp,
correlation = corAR1(form= ~ Day|Mesocosm),
family= negbin(THETA, link="log"))
3) And finally, can I somehow compare the mode...
2010 Feb 04
1
Zero inflated negat. binomial model
...g at the association between these two variables, i.e. how well does chick size predict tape intensity?
I fit a zero inflated negat. binomial model using the "pscl" package.
I built my model as follows and got the output below.
> model <- zeroinfl(Int_Cesto ~ CAPI, dist = "negbin", EM = TRUE)
> model
Call:
zeroinfl(formula = Int_Cesto ~ CAPI, dist = "negbin", EM = TRUE)
Count model coefficients (negbin with log link):
(Intercept) CAPI
-2.99182 0.06817
Theta = 0.4528
Zero-inflation model coefficients (binomial with logit link):
(Inte...
2009 Dec 30
2
Negbin Error Warnings
Hi,
I ran a negative binomial regression (NBR) using the Zelig-package and the negbin model.
When I then try to use the simumlation approach using the setx () and sim() functions to calculate expected values
and first difference for different levels of one of my independent variables, I get 50 errors warnings, telling me that the calculation rpois produced NAs. However, the data I...
2011 Sep 22
1
negative binomial GAMM with variance structures
...I am having some difficulty converting my gam code to a correct gamm code, and I'm really hoping someone will be able to help me.
I was previously using this script for my overdispersed gam data:
M30 <-gam(efuscus~s(mic, k=7) +temp +s(date)+s(For3k, k=7) + pressure+ humidity, family=negbin(c(1,10)), data=efuscus)
My gam.check gave me the attached result. In order to deal with my heterogeneity, I need to switch over to a gamm structure and use at least one, but possibly multiple, variance structures, and I am starting by applying varPower to my temperature covariate. (Efuscus i...
2012 Aug 24
3
mgcv package, problems with NAs in gam
Hi there,
I'm using presence-absence data in a gam (i.e. 0 or 1 as values)
I am trying to run a gam with 'dummy covariates' i.e. 1~1
unfortunately my model:
*
model<-gam(1~1, data=bats, family=negbin)*
keeps putting out:
*
Error in gam(1 ~ 1, data = bats, family = negbin) :
Not enough (non-NA) data to do anything meaningful*
Is there a specific reason it would do this? I have tried using various
actions on NAs, na.pass etc, as well as asking it to turn all NAs to 0 but
to no avail.
I wou...
2005 Jun 30
1
RE : Dispersion parameter in Neg Bin GLM
Edward, you also can use the package aod on CRAN, see the help page of the function negbin.
Best
Matthieu
An example:
> library(aod)
> data(dja)
> negbin(y ~ group + offset(log(trisk)), ~group, dja, fixpar = list(4, 0))
Negative-binomial model
-----------------------
negbin(formula = y ~ group + offset(log(trisk)), random = ~group,
data = dja, fixpar = list(4, 0))...
2005 Jun 02
1
glm with variance = mu+theta*mu^2?
How might you fit a generalized linear model (glm) with variance =
mu+theta*mu^2 (where mu = mean of the exponential family random variable
and theta is a parameter to be estimated)?
This appears in Table 2.7 of Fahrmeir and Tutz (2001) Multivariate
Statisticial Modeling Based on Generalized Linear Models, 2nd ed.
(Springer, p. 60), where they compare "log-linear model fits to
2011 May 23
1
Interpreting the results of the zero inflated negative binomial regression
...n
R. I have to deal with zero inflated negative binomial distribution. I am
however unable to understand the following example from this link
http://www.ats.ucla.edu/stat/r/dae/zinbreg.htm
The result gives two blocks.
*library(pscl)
zinb<-zeroinfl(count ~ child + camper | persons, dist = "negbin", EM = TRUE)
summary(zinb)
*Call:
zeroinfl(formula = count ~ child + camper | persons, dist = "negbin",
EM = TRUE)
Count model coefficients (negbin with log link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.3711 0.2561 5.353 8.63e-08 ***
child...
2005 Nov 08
1
Poisson/negbin followed by jackknife
Folks,
Thanks for the help with the hier.part analysis. All the problems
stemmed from an import problem which was solved with file.chose().
Now that I have the variables that I'd like to use I need to run some
GLM models. I think I have that part under control but I'd like to use
a jackknife approach to model validation (I was using a hold out sample
but this seems to have fallen out
2018 Feb 16
1
hurdle model - count and response predictions
...on-count-vs-response
).
Since the issue is the same (and not resolved), I'll just use the example
from the second link:
library("pscl")
data("RecreationDemand", package = "AER")
## model
m <- hurdle(trips ~ quality | ski, data = RecreationDemand, dist = "negbin")
nd <- data.frame(quality = 0:5, ski = "no")
predict(m, newdata = nd, type = "count")
predict(m, newdata = nd, type = "response")
The presence/absence part of the model gives identical estimates to a
logistic model run on the data. However, I thought that the...
2010 Mar 03
1
Zero inflated negative binomial
...- glm.nb(AvGUD ~ Year*Trt*Micro)
where Year has 3 levels, Trt has 2 levels and Micro has 3 levels.
However when I run it has a zero inflated negative binomial (as I have lots
of zeros) I get the below error message:
> Zinb <- zeroinfl(AvGUD ~ Year*Trt*Micro |1, data = AvGUD89, dist =
"negbin")
Error in optim(fn = loglikfun, gr = gradfun, par = c(start$count,
start$zero, :
non-finite value supplied by optim
For what I have read I think the problem is that for Year level 3 there is
no Trt 1 and for Year level 1 there is no Micro level 3.
I cannot find a solution to this problem,...
2007 Apr 08
1
Relative GCV - poisson and negbin GAMs (mgcv)
...often seems only to change in the second or third decimal place for the same models.
Is there a standard for how many decimals one should look at GCV, or am I totally missing something (I'm quite new to this, as I'm sure is obvious). Why such a difference in GCV change between poisson and negbin?
Thanks in advance!
Jordan
library(mgcv)
set.seed(0)
n<-400
sig<-2
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <- runif(n, 0, 1)
f0 <- function(x) 2 * sin(pi * x)
f1 <- function(x) exp(2 * x)
f2 <- function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1...