Displaying 20 results from an estimated 9000 matches similar to: "Negative Binomial modelling"
2003 Feb 01
1
Trouble with optim
I am having trouble with optim. It claims to have converged to a minimum,
yet it has in the course of the optimization visited many points which are
closer to optimal. I would be grateful for any explanation of this
behaviour.
I'm trying to estimate the parameters in the model
X ~ Binomial(1,p) * NegBin(mu,theta).
So I define a log likelihood function, and invoke optim thus:
o <- optim
2003 Jan 11
2
beta-binomial
Does anyone have R functions or library to fit a beta-binomial distribution
with glm? Thanks.
2005 Jan 25
1
Threshhold Models in gnlm
Hello,
I am interested in fitting a generalized nonlinear regression (gnlr) model
with negative binomial errors.
I have found Jim Lindsay's package that will do gnlr, but I have having
trouble with the particular model I am interested in fitting.
It is a threshhold model, where below a certain value of one of the
parameters being fitted, the model changes.
Here is a sample:
Cones:
2006 Jul 14
2
Negative Binomial: Simulation
Hi R-Users!
I fitted a negative binomial distribution to my count data using the
function glm.nb() and obtained the calculated parameters
theta (dispersion) and mu.
I would like to simulate values from this negative binomial distribution.
Looking at the function rnbinom() I was looking at the relationship
between the two possible parametrizations of the negative binomial and found
that for this
2003 Jul 30
2
Plotting a function with curve()
Why does
> curve(function(y) y^2, from=0,to=1)
not work, whereas
> myf <- function(y) y^2
> curve(myf, from=0,to=1)
work?
For the former, I get the error message
Error in curve(function(y) y^2, from = 0, to = 1) :
'expr' must be a function or an expression containing 'x'
I'm using R1.7.0 under Windows XP.
Damon Wischik.
2013 Feb 28
3
Negative Binomial Regression - glm.nb
Dear all,
I would like to ask, if there is a way to make the variance / dispersion parameter $\theta$ (referring to MASS, 4th edition, p. 206) in the function glm.nb dependent on the data, e.g. $1/ \theta = exp(x \beta)$ and to estimate the parameter vector $\beta$ additionally.
If this is not possible with glm.nb, is there another function / package which might do that?
Thank you very much for
2006 Feb 18
1
truncated negative binomial using rnegbin
Dear R users,
I'm wanting to sample from the negative binomial distribution using the
rnegbin function from the MASS library to create artificial samples for the
purpose of doing some power calculations. However, I would like to work
with samples that come from a negative binomial distribution that includes
only values greater than or equal to 1 (a truncated negative binomial), and
I
2006 Jul 28
2
negative binomial lmer
To whom it may concern:
I have a question about how to appropriately conduct an lmer analysis for negative binomially distributed data. I am using R 2.2.1 on a windows machine.
I am trying to conduct an analysis using lmer (for non-normally distributed data and both random and fixed effects) for negative binomially distributed data. To do this, I have been using maximum likelihood,
2011 Nov 17
1
How to Fit Inflated Negative Binomial
Dear All,
I am trying to fit some data both as a negative binomial and a zero
inflated binomial.
For the first case, I have no particular problems, see the small snippet
below
library(MASS) #a basic R library
set.seed(123) #to have reproducible results
x4 <- rnegbin(500, mu = 5, theta = 4)
#Now fit and check that we get the right parameters
fd <- fitdistr(x4, "Negative
2003 Jan 10
1
Superposed histograms
I woud like to plot cumulative histograms. Specifically,
I have data like
Sex M M F M F F M F
Height 6 6.3 6.1 5.5 7.2 6.2 5.9 6.0 ....
and I want to plot a histogram of the distribution of all heights,
colouring the histogram bars according to sex, for example
| o
| oo o
| o oo ** o o = observations of women
| o o*o***o * = observations of
2003 Mar 10
2
Biplots
I want to plot biplots. I have seen the function biplot, but there are
some extra features I would like, that I do not know how to achieve.
1. My observations, and my variables, fall into groups. Is there a way to,
say, plot the observations in several different colours, according to
which group the observation falls into? Similarly with the variables? I am
used to the lattice idiom, in which one
2010 Nov 15
1
comparing levels of aggregation with negative binomial models
Dear R community,
I would like to compare the degree of aggregation (or dispersion) of
bacteria isolated from plant material. My data are discrete counts
from leaf washes. While I do have xy coordinates for each plant, it
is aggregation in the sense of the concentration of bacteria in high
density patches that I am interested in.
My attempt to analyze this was to fit negative binomial
2003 Sep 04
3
Overlaying graphs
----- Original Message -----
From: "Richard A. O'Keefe" <ok at cs.otago.ac.nz>
To: <paul at datavore.com>
Sent: Thursday, September 04, 2003 2:56 AM
Subject: Re: [R] Overlaying graphs
> I do not know how to overlay the curve graphic on top of hist graphic.
>
> Do you know about the "add=TRUE" option for plot()?
>
> I am hoping to show visually
2003 Mar 02
2
ESS+R not closing gracefully
I am having trouble with ESS+R. I don't know if it is an ESS
problem or an R problem, so I'm posting to this mailing list in
the first instance.
I am using R 1.6.2, Windows XP (latest updates installed), XEmacs 21.4,
and ESS 5.1.21. I have experienced the same problem under Windows 2000 and
recent versions of Emacs and ESS (though my current Windows XP
installation is from scratch, and
2009 Apr 04
1
summary for negative binomial GLMs (PR#13640)
Full_Name: Robert Kushler
Version: 2.7.2
OS: Windows XP
Submission from: (NULL) (69.246.102.98)
I believe that the negative binomial family (from MASS) should be added to the
list for which dispersion is set to 1.
2003 Dec 17
6
Factor names & levels
When I alter the levels of a factor, why does it alter the names too?
f <- factor(c(A="one",B="two",C="one",D="one",E="three"),
levels=c("one","two","three"))
names(f)
-- gives [1] "A" "B" "C" "D" "E"
levels(f) <-
2007 Apr 17
2
format() applied to an NA character string (PR#9616)
I get strange results when I try to format() an NA character string.
> x <- 'sometext'
> x[1] <- NA
> format(NA, width=32) # displays sensibly, right-justified
> format(x,width=32) # displays sensibly, left-justified
> format(x,width=33) # displays ""
> format(x,width=36) # R exits abnormally with code 5
> version
platform i386-pc-mingw32
2010 Jul 06
1
nls + quasi-poisson distribution
Hello R-helpers,
I would like to fit a non-linear function to data (Discrete X axis,
over-dispersed Poisson values on the Y axis).
I found the functions gnlr in the gnlm package from Jim Lindsey: this can
handle nonlinear regression equations for the parameters of Poisson and
negative binomial distributions, among others. I also found the function
nls2 in the software package
2007 Jan 06
2
negative binomial family glm R and STATA
Dear Lister,
I am facing a strange problem fitting a GLM of the negative binomial
family. Actually, I tried to estimate theta (the scale parameter)
through glm.nb from MASS and could get convergence only relaxing the
convergence tolerance to 1e-3. With warning messages:
glm1<-glm.nb(nbcas~.,data=zonesdb4,control=glm.control(epsilon = 1e-3))
There were 25 warnings (use warnings() to see
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)