similar to: Negative Binomial: Simulation

Displaying 20 results from an estimated 3000 matches similar to: "Negative Binomial: Simulation"

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
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
2005 Mar 03
1
Negative binomial regression for count data
Dear list, I would like to fit a negative binomial regression model as described in "Byers AL, Allore H, Gill TM, Peduzzi PN., Application of negative binomial modeling for discrete outcomes: a case study in aging research. J Clin Epidemiol. 2003 Jun;56(6):559-64" to my data in which the response is count data. There are also 10 predictors that are count data, and I have also 3
2006 Jul 18
1
Inflated Array
Hi R-users! I am trying to create a what I call inflated array (maybe there is already some other name for that). It is an array that changes dinamically its dimensions, e.g. the higher the number of third dimensions, the more rows in the array. So for example the array could look like the following: , ,1 1 2 3 4 , , 2 5 6 7 8 9 10 11 12 , , 3 13 14 15 16 17 18 19 20 21 22 23 24 Has
2005 Jan 25
1
Zipf random number generation
Hi, Is there a Zipf-like distribution RNG in R? Thanks, Weiguang
2011 May 04
1
hurdle, simulated power
Hi all-- We are planning an intervention study for adolescent alcohol use, and I am planning to use simulations based on a hurdle model (using the hurdle() function in package pscl) for sample size estimation. The simulation code and power code are below -- note that at the moment the "power" code is just returning the coefficients, as something isn't working quite right. The
2012 Oct 19
2
MLE of negative binomial distribution parameters
I need to estimate the parameters for negative binomial distribution (pdf) using maximun likelihood, I also need to estimate the parameter for the Poisson by ML, which can be done by hand, but later I need to conduct a likelihood ratio test between these two distributions and I don't know how to start! I'm not an expert programmer in R. Please help -- View this message in context:
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 >
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.
2008 Dec 11
2
negative binomial lmer
Hi; I am running generalized linear mixed models (GLMMs) with the lmer function from the lme4 package in R 2.6.2. My response variable is overdispersed, and I would like (if possible) to run a negative binomial GLMM with lmer if possible. I saw a posting from November 15, 2007 which indicated that there was a way to get lmer to work with negative binomial by assigning: family =
2005 Jan 05
3
strange behaviour of negative binomial
Dear list, I ran into a strange behaviour of the pnbinom function - or maybe I just made a stupid mistake. First thing is that pnbinom seems to be very slow. The other - more interesting one - is that I get two different curves when I plot the estimated density and the density given by pnbinom. Shouldn't it be the same? This is only the case, I think, if I use the parameter size = 1. I
2009 Jan 28
1
Character SNP data to binary MAF data
Hi I am sure there is a function out there already but I couldn't find it. I have SNP data, that is, a matrix which contains in each row two characters (they are different in each row) and I would like to convert this matrix to a binary one according to the minor allele frequency. For non-geneticists: I want to have a binary matrix for which in each row the 0 stands for the less frequent
2004 May 28
0
Negative binomial glm and dispersion
Using R 1.8.1, and the negative binomial glm implemented in MASS, the default when using anova and a chi-square test is to divide the deviance by the estimated dispersion. Using my UNIX version of S-plus (v 3.4), and the same MASS functions, the deviances are *not* divided by the estimated dispersion. Firstly, I'm wondering if anyone can enlighten about the correct procedure (I thought
2008 May 16
1
gam negative.binomial
Dear list members, while I appreciate the possibility to deal with overdispersion for count data either by specifying the family argument to be quasipoisson() or negative.binomial(), it estimates just one overdispersion parameter for the entire data set. In my applications I often would like the estimate for overdispersion to depend on the covariates in the same manner as the mean. For example,
2004 Feb 10
1
generate random sample from ZINB
I want to generate 1,000 random samples of sample size=1,000 from ZINB. I know there is a rnegbin() to generate random samples from NB, and I know I can use the following process: do i=1 to 1000 n=0 do i=1 to 1000 if runi(1)>0.1 then x(i) = 0; else x(i)=rnegbin(); n=n+1; if n>1000 then stop; end; output; end; Anybody can help me out with the R code? Thanks very much ahead of time.
2003 Aug 06
2
Importing Data
Im trying to import data from an excel sheet or a sas file to R...im not succeeding. Apparently the function read.xport for reading a SAS file doesnt exist. What do i have to type in EXACTLY to read from an excel sheet(i guess i would be using read.table?)? Thanks in advance for an answer Dassy
2005 Mar 11
0
Negative binomial regression for count data,
Dear list, I would like to know: 1. After I have used the R code (http://pscl.stanford.edu/zeroinfl.r) to fit a zero-inflated negative binomial model, what criteria I should follow to compare and select the best model (models with different predictors)? 2. How can I compare the model I get from question 1 (zero-inflated negative binomial) to other models like glm family models or a logistic
2010 Jan 19
1
splitting a factor in an analysis of deviance table (negative binomial model)
Dears useRs, I have 2 factors, (for the sake of explanation - A and B), with 4 levels each. I've already fitted a negative binomial generalized linear model to my data, and now I need to split the factors in two distinct analysis of deviance table:  - A within B1, A within B2, A within B3 and A within B4  - B within A1, B within A2, B within A3 and B within A4 Here is a code that illustrates
2009 Jan 11
1
Makevars
Hi I have sent a previous email "Error in dyn.load()" for which, shame on me, I later found a partial answer. I have been trying to look into what I exactly need to include into Makevars and where it needs to be located and have not found a satisfying answer yet. Maybe the following questions are helpful for other people as well. Again, I am trying to include a C function tools.c into
2010 Jan 06
2
Choose variables according to index
Hi There must have someone already posted this question but I still have not figured how I could do this: Say I have var.1 var.2 var.3 which are large matrices. I would like to do the following loop: for(i in 1:3){ # Pick var.i and do something with it } How can I tell R to do this? Thanks for any comments. Hadassa [[alternative HTML version deleted]]