similar to: mgcv package, problems with NAs in gam

Displaying 20 results from an estimated 4000 matches similar to: "mgcv package, problems with NAs in gam"

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) >
2013 Jul 23
1
Help with using unpenalised te smooth in negative binomial mgcv gam
Hi, I have been trying to fit an un-penalised gam in mgcv (in order to get more reliable p-values for hypothesis testing), but I am struggling to get the model to fit sucessfully when I add in a te() interaction. The model I am trying to fit is: gam(count~ s(x1, bs = "ts", k = 4, fx = TRUE) + s(x2, bs = "ts", k = 4, fx = TRUE) + te(x2, x3, bs =
2011 Sep 22
1
negative binomial GAMM with variance structures
Hello, 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
2010 Sep 03
2
Interactions in GAM
Hello R users, I am working with the GAM to inspect the effect of some factors (year, area) and continuous variables (length, depth, latitude and longitude) on the intensity and prevalence of the common parasite Anisakis. I would like introduce interaction in my models, both "continuous variables-continuous variables" and "continuous variables-factor". I have read some
2012 Dec 07
1
Negative Binomial GAMM - theta values and convergence
Hi there, My question is about the 'theta' parameter in specification of a NB GAMM. I have fit a GAM with an optimum structure of: SB.gam4<-gam(count~offset(vol_offset)+ s(Depth_m, by=StnF, bs="cs")+StageF*RegionF, family=negbin(1, link=log), data=Zoop_2011[Zoop_2011$SpeciesF=='SB',]) However, this GAM shows heterogeneity in the
2007 Apr 08
1
Relative GCV - poisson and negbin GAMs (mgcv)
I am using gam in mgcv (1.3-22) and trying to use gcv to help with model selection. However, I'm a little confused by the process of assessing GCV scores based on their magnitude (or on relative changes in magnitude). Differences in GCV scores often seem "obvious" with my poisson gams but with negative binomial, the decision seems less clear. My data represent a similar pattern as
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
2011 Jun 09
0
Fwd: Re: residual checking for GAM (mgcv)
The plots look reasonable to me. The plot of residuals against linear predictor always looks scary when many of the fitted values are very close to zero, so I tend to look at residuals against sqrt(fitted) in such cases. I don't think that the presence of the zero curve is a reason to reject the model --- it's easy to produce such plots by fitting a completely correct model to simulated
2010 Feb 11
1
Zero-inflated Negat. Binom. model
Dear R crew: I am sorry this question has been posted before, but I can't seem to solve this problem yet. I have a simple dataset consisting of two variables: cestode intensity and chick size (defined as CAPI). Intensity is a count and clearly overdispersed, with way too many zeroes. I'm interested in looking at the association between these two variables, i.e. how well does chick
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:
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.
2010 Feb 04
1
Zero inflated negat. binomial model
Dear R crew: I think I am in the right mailing list. I have a very simple dataset consisting of two variables: cestode intensity and chick size (defined as CAPI). Intensity is clearly overdispersed, with way too many zeroes. I'm interested in looking at the association between these two variables, i.e. how well does chick size predict tape intensity? I fit a zero inflated negat. binomial
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 be in accordance with the Value listing in the negbin entry in the aod
2008 Jun 11
1
mgcv::gam error message for predict.gam
Sometimes, for specific models, I get this error from predict.gam in library mgcv: Error in complete.cases(object) : negative length vectors are not allowed Here's an example: model.calibrate <- gam(meansalesw ~ s(tscore,bs="cs",k=4), data=toplot, weights=weight, gam.method="perf.magic") > test <- predict(model.calibrate,newdata) Error in
2009 Mar 24
2
help: what are the basis functions in {mgcv}: gam?
I am writing my thesis with the function gam(), with the package {mgcv}. My command is: gam(y~s(x1,bs="cr")+s(x2, bs="cr")). I need help to know what are the default basis funcitons for gam. I have not found any detailed reference for this. Can anyone help me with this?? -- View this message in context:
2007 Dec 13
1
Two repeated warnings when runing gam(mgcv) to analyze my dataset?
Dear all, I run the GAMs (generalized additive models) in gam(mgcv) using the following codes. m.gam <-gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbinary,family=binomial(logit),data=point) And two repeated warnings appeared. Warnings$B!'(B 1: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : Algorithm did not converge 2: In gam.fit(G,
2012 Jul 30
2
mgcv 1.7-19, vis.gam(): "invalid 'z' limits'
Hi everyone, I ran a binomial GAM consisting of a tensor product of two continuous variables, a continuous parametric term and crossed random intercepts on a data set with 13,042 rows. When trying to plot the tensor product with vis.gam(), I get the following error message: Error in persp.default(m1, m2, z, col = col, zlim = c(min.z, max.z), xlab = view[1], : invalid 'z' limits In
2012 Feb 03
1
GAM (mgcv) warning: matrix not positive definite
Dear list, I fitted the same GAM model using directly the function gam(mgcv) ... then as a parameter of another function that capture the warnings messages (see below). In the first case, there is no warning message printed, but in the last one, the function find two warning messages stating "matrix not positive definite" So my question is: Do I have to worry about those warnings and
2004 Sep 27
2
passing formula arg to mgcv::gam
Hi, I have a function, callGam, that fits a gam model to a subset of a dataframe. The argument to callGam is a formula, the subset is determined inside the function itself. My na??ve approach generates and error, see below. I guess this is because 'idx' is loocked up in the environment of 'formula', but I am too ignorant about environments to be able to tell for sure. Could
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