Displaying 20 results from an estimated 8000 matches similar to: "Problem with gam() after R update"
2003 Jun 04
2
gam()
Dear all,
I've now spent a couple of days trying to learn R and, in particular, the
gam() function, and I now have a few questions and reflections regarding
the latter. Maybe these things are implemented in some way that I'm not yet
aware of or have perhaps been decided by the R community to not be what's
wanted. Of course, my lack of complete theoretical understanding of what
2007 Jun 22
1
two basic question regarding model selection in GAM
Qusetion #1
*********
Model selection in GAM can be done by using:
1. step.gam {gam} : A directional stepwise search
2. gam {mgcv} : Smoothness estimation using GCV or UBRE/AIC criterion
Suppose my model starts with a additive model (linear part + spline part).
Using gam() {mgcv} i got estimated degrees of freedom(edf) for the smoothing
splines. Now I want to use the functional form of my model
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,
2002 Nov 13
2
Comparing GAM objects using ANOVA
Hi,
Is it possible to compare two GAM objects created with the gam() function from the mgcv package. I use a slightly modified version of anova.glm() named anova.gam(), modified from John Fox (2002). It often gives me some aberant responses, especially with "F" test. I use a quasibinomial model and scale (dispersion) is calculated and used in the calculation of the F value. Does someone
2007 Oct 05
2
question about predict.gam
I'm fitting a Poisson gam model, say
model<-gam(a65tm~as.factor(day.week
)+as.factor(week)+offset(log(pop65))+s(time,k=10,bs="cr",fx=FALSE,by=NA,m=1),sp=c(
0.001),data=dati1,family=poisson)
Currently I've difficulties in obtaining right predictions by using
gam.predict function with MGCV package in R version 2.2.1 (see below my
syntax).
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
2012 Aug 14
1
Random effects in gam (mgcv 1.7-19)
Hi,
I am using the gam function in the mgcv package, I have random effects in
my model (bs="re") this has worked fine, but after I updated the mgcv
package to version 1.7-19 I recive an error message when I run the model.
>
fit1<-gam(IV~s(RUTE,bs="re")+s(T13)+s(H40)+factor(AAR)+s(V3)+s(G1)+s(H1)+s(V1)+factor(LEDD),data=data5,method="ML")
> summary.gam(fit1)
2012 Jul 23
1
mgcv: Extract random effects from gam model
Hi everyone,
I can't figure out how to extract by-factor random effect adjustments from a
gam model (mgcv package).
Example (from ?gam.vcomp):
library(mgcv)
set.seed(3)
dat <- gamSim(1,n=400,dist="normal",scale=2)
a <- factor(sample(1:10,400,replace=TRUE))
b <- factor(sample(1:7,400,replace=TRUE))
Xa <- model.matrix(~a-1) ## random main effects
Xb <-
2005 Oct 05
3
testing non-linear component in mgcv:gam
Hi,
I need further help with my GAMs. Most models I test are very
obviously non-linear. Yet, to be on the safe side, I report the
significance of the smooth (default output of mgcv's summary.gam) and
confirm it deviates significantly from linearity.
I do the latter by fitting a second model where the same predictor is
entered without the s(), and then use anova.gam to compare the
2011 Dec 09
3
gam, what is the function(s)
Hello,
I'd like to understand 'what' is predicting the response for library(mgcv)
gam?
For example:
library(mgcv)
fit <- gam(y~s(x),data=as.data.frame(l_yx),family=binomial)
xx <- seq(min(l_yx[,2]),max(l_yx[,2]),len=101)
plot(xx,predict(fit,data.frame(x=xx),type="response"),type="l")
I want to see the generalized function(s) used to predict the response
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 17
1
Standard errors from predict.gam versus predict.lm
I've got a small problem.
I have some observational data (environmental samples: abiotic explanatory variable and biological response) to which I've fitted both a multiple linear regression model and also a gam (mgcv) using smooths for each term. The gam clearly fits far better than the lm model based on AIC (difference in AIC ~ 8), in addition the adjusted R squared for the gam is
2004 Oct 12
3
need help on GAM
Get some question about the function "gam".
Suppose I have a semiparametric model,
Y~x1+x2+s(z1).
Using "gam", how could I get the estimates for the parametric part and
nonparametric part respectively?
And another question: we could find the coefficients for both
parametric term and nonparametric term, what do these coefficients
for the nonparametric term stand for, the
2004 Dec 22
2
GAM: Getting standard errors from the parametric terms in a GAM model
I am new to R. I'm using the function GAM and wanted to get standard errors
and p-values for the parametric terms (I fitted a semi-parametric models).
Using the function anova() on the object from GAM, I only get p-values for
the nonparametric terms.
Does anyone know if and how to get standard errors for the parametric terms?
Thanks.
Jean G. Orelien
2013 Jun 17
1
Can you use two offsets in gam (mgcv)?
Hello,
I have been trying to find out whether it is possible to use more than one
offset in a gam (in mgcv).
The reason I would like to do this is to 1) account for area surveyed in a
Poisson model of sightings of porpoises within defined grid cells (each cell
has a slightly different area) and 2) account for detection probability
within each grid cell (some grid cells are further away from the
2005 Sep 26
4
p-level in packages mgcv and gam
Hi,
I am fairly new to GAM and started using package mgcv. I like the
fact that optimal smoothing is automatically used (i.e. df are not
determined a priori but calculated by the gam procedure).
But the mgcv manual warns that p-level for the smooth can be
underestimated when df are estimated by the model. Most of the time
my p-levels are so small that even doubling them would not result
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis.
The following is the 'hierarchy' of models I would like to test:
(1) Y_i = a + integral[ X_i(t)*Beta(t) dt ]
(2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ]
(3) Y_i = a + integral[ F{X_i(t),t} dt ]
equivalents for discrete data might be:
1) Y_i = a + sum_t[ L_t * X_it * Beta_t ]
(2) Y_i
2004 Aug 06
2
gam --- a new contributed package
I have contributed a "gam" library to CRAN,
which implements "Generalized Additive Models".
This implementation follows closely the description in
the GAM chapter 7 of the "white" book "Statistical Models in S"
(Chambers & Hastie (eds), 1992, Wadsworth), as well as the philosophy
in "Generalized Additive Models" (Hastie & Tibshirani 1990,
2004 Aug 06
2
gam --- a new contributed package
I have contributed a "gam" library to CRAN,
which implements "Generalized Additive Models".
This implementation follows closely the description in
the GAM chapter 7 of the "white" book "Statistical Models in S"
(Chambers & Hastie (eds), 1992, Wadsworth), as well as the philosophy
in "Generalized Additive Models" (Hastie & Tibshirani 1990,
2006 Jun 18
1
GAM selection error msgs (mgcv & gam packages)
Hi all,
My question concerns 2 error messages; one in the gam package and one in
the mgcv package (see below). I have read help files and Chambers and
Hastie book but am failing to understand how I can solve this problem.
Could you please tell me what I must adjust so that the command does not
generate error message?
I am trying to achieve model selection for a GAM which is required for