Displaying 20 results from an estimated 5000 matches similar to: "proportion explained by each term in a GAM"
2011 Mar 11
0
variance explained by each term in a GAM
Picking up an ancient thread (from Oct 2007), I have a somewhat more complex
problem than given in Simon Wood's example below. My full model has more than
two smooths as well as factor variables as in this simplified example:
b <- gam(y~fv1+s(x1)+s(x2)+s(x3))
Judging from Simon's example, my guess is to fit reduced models to get
components of deviance as follows:
b1 <-
2011 Nov 10
1
Sum of the deviance explained by each term in a gam model does not equal to the deviance explained by the full model.
Dear R users,
I read your methods of extracting the variance explained by each
predictor in different places. My question is: using the method you
suggested, the sum of the deviance explained by all terms is not equal to
the deviance explained by the full model. Could you tell me what caused
such problem?
> set.seed(0)
> n<-400
> x1 <- runif(n, 0, 1)
> ## to see problem
2007 Oct 08
2
variance explained by each term in a GAM
Hello fellow R's,
I do apologize if this is a basic question. I'm doing some GAMs using the mgcv package, and I am wondering what is the most appropriate way to determine how much of the variability in the dependent variable is explained by each term in the model. The information provided by summary.gam() relates to the significance of each term (F, p-value) and to the
2009 Jul 12
1
variance explained by each predictor in GAM
Hi,
I am using mgcv:gam and have developed a model with 5 smoothed predictors
and one factor.
gam1 <- gam(log.sp~ s(Spr.precip,bs="ts") + s(Win.precip,bs="ts") + s(
Spr.Tmin,bs="ts") + s(P.sum.Tmin,bs="ts") + s( Win.Tmax,bs="ts")
+factor(site),data=dat3)
The total deviance explained = 70.4%.
I would like to extract the variance explained
2011 Apr 12
1
Model checking for gam (mgcv) result
Dear list,
i'm checking the residuals plots of a gam model after a processus of model
selection. I found the "best" model, all my terms are significant, the
r-square and the deviance explained are good, but I have strange residuals
plots:
http://dl.dropbox.com/u/1169100/gam.check.png
http://dl.dropbox.com/u/1169100/residuals_vs_fitted.png
What does explains the "curve"
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
2009 Feb 25
1
monotonic GAM with more than one term
Hi,
Does anyone know how to fit a GAM where one or more smooth terms are
constrained to be monotonic, in the presence of "by" variables or
other terms? I looked at the example in ?pcls but so far have not been
able to adapt it to the case where there is more than one predictor.
For example,
require(mgcv)
set.seed(0)
n<-100
# Generate data from a monotonic truth.
2009 Jun 23
1
Model fitting with GAM and "by" term
Hello R Users,
I have a question regarding fitting a model with GAM{mgcv}. I have data
from several predictor (X) variables I wish to use to develop a model to
predict one Y variable. I am working with ecological data, so have data
collected many times (about 20) over the course of two years. Plotting
data independently for each date there appears to be relationships
between Y (fish density)
2008 Jan 03
1
GLM results different from GAM results without smoothing terms
Hi, I am fitting two models, a generalized linear model and a generalized
additive model, to the same data. The R-Help tells that "A generalized
additive model (GAM) is a generalized linear model (GLM) in which the linear
predictor is given by a user specified sum of smooth functions of the
covariates plus a conventional parametric component of the linear
predictor." I am fitting the GAM
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
2005 Sep 23
1
Smooth terms significance in GAM models
hi,
i'm using gam() function from package mgcv with default option (edf
estimated by GCV).
>G=gam(y ~ s(x0, k = 5) + s(x1) + s(x2, k = 3))
>SG=summary(G)
Formula:
y ~ +s(x0, k = 5) + s(x1) + s(x2, k = 3)
Parametric coefficients:
Estimate std. err. t ratio Pr(>|t|)
(Intercept) 3.462e+07 1.965e+05 176.2 < 2.22e-16
Approximate significance of smooth
2003 Sep 17
0
attributing names in predicted type="terms" gam object
Hi,
suppose i have a gam object
gamobject<- gam( Y~ s(X1)+s(X2)+ X3)
I would like to extract the predicted partial effect of X3 but selecting
it by its name, as it's to be included in a function and i don't always
know the exact position of X3.
something like predict(gamobject,type="terms")["X3",]. But that doesn't
work as there's no name.
So, looking
2009 May 05
1
A question about using “by” in GAM model fitting of interaction between smooth terms and factor
I am a little bit confusing about the following help message on how to fit a
GAM model with interaction between factor and smooth terms from
http://rss.acs.unt.edu/Rdoc/library/mgcv/html/gam.models.html:
?Sometimes models of the form:
E(y)=b0+f(x)z
need to be estimated (where f is a smooth function, as usual.) The
appropriate formula is:
y~z+s(x,by=z)
- the by argument ensures that the smooth
2007 Apr 16
1
Does the smooth terms in GAM have a functional form?
Hi, all,
Does anyone know how to get the functional form of the smooth terms in GAM? eg. I fit y=a+b*s(x) where s is the smooth function.
After fitting this model with GAM in R, I want to know the form of the s(x). Any suggestion is appreciated.
Thanks,
Jin
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
2011 Mar 07
0
Conflict between gam::gam and mgcv::gam
I am trying to compare and contrast the smoothing in the {mgcv} version
of gam vs. the {gam} version of gam but I get a strange side effects
when I try to alternate calls to these routines, even though I detach
and unload namespaces.
Specifically when I start up R the following code runs successfully
until the last line i.e. plot(g4,se=TRUE) when I get "Error in
dim(data) <- dim :
2008 Feb 28
0
use of step.gam (from package 'gam') and superassignment inside functions
Hello,
I am using the function step.gam() from the 'gam' package (header info
from library(help=gam) included below) and have come across some
behavior that I cannot understand. In short, I have written a function
that 1) creates a dataframe, 2) calls gam() to create a gam object, then
3) calls step.gam() to run stepwise selection on the output from gam().
When I do this, gam()
2005 Apr 18
0
Discrepancy between gam from gam package and gam in S-PLUS
Dear Trevor,
I've noticed a discrepancy in the degrees of freedom reported by gam() from
the gam package in R vs. gam() in S-PLUS. The nonparametric df differ by 1;
otherwise (except for things that depend upon the df), the output is the
same:
--------- snip ------------
*** From R (gam version 0.93):
> mod.gam <- gam(prestige ~ lo(income, span=.6), data=Prestige)
>
2006 Dec 04
1
GAM model selection and dropping terms based on GCV
Hello,
I have a question regarding model selection and dropping of terms for GAMs fitted with package mgcv. I am following the approach suggested in Wood (2001), Wood and Augustin (2002).
I fitted a saturated model, and I find from the plots that for two of the covariates,
1. The confidence interval includes 0 almost everywhere
2. The degrees of freedom are NOT close to 1
3. The partial
2005 Mar 24
1
Prediction using GAM
Recently I was using GAM and couldn't help noticing
the following incoherence in prediction:
> data(gam.data)
> data(gam.newdata)
> gam.object <- gam(y ~ s(x,6) + z, data=gam.data)
> predict(gam.object)[1]
1
0.8017407
>
predict(gam.object,data.frame(x=gam.data$x[1],z=gam.data$z[1]))
1
0.1668452
I would expect that using two types of predict
arguments
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