Displaying 20 results from an estimated 6000 matches similar to: "Understanding why a GAM can't have an intercept"
2012 Oct 10
2
GAM without intercept
Hi everybody,
I am trying to fit a GAM model without intercept using library mgcv. 
However, the result has nothing to do with the observed data. In fact 
the predicted points are far from the predicted points obtained from the 
model with intercept. For example:
#First I generate some simulated data:
library(mgcv)
x<-seq(0,10,length=100)
y<-x^2+rnorm(100)
#then I fit a gam model with
2009 Sep 20
1
How to choose knots for GAM?
Hi, all
I want to choose same knots in GAM for 10 different studies so that they has
the same basis function. Even though I choose same knots and same dimensions
of basis  smoothing, the basis representations are still not same.
My command is as follows:
data.gam<-gam(y~s(age,bs='cr',k=10)+male,family=binomial,knots=list(age=seq(45,64,length=10)))
What is my mistake for choice of
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
2007 Feb 28
2
Help on GAM
1) I have a semiparametric model, like
*Y~x1+s(x2)+s(x3)*
When I rum gam package I only obtained the estimates and the statistics of
the nonparametric part. How can I get the parametric part? Please could you
give me the complete comand to do it.
2) How are the negative coefficients identified. I run different examples
and I never got any negative parameters.
Thank you,
Dacha
	[[alternative
2002 Jan 28
6
Almost a GAM?
Hello:
I sent this question the other day with the wrong subject
heading and couple typos, with no response.  So, 
here I go again, having made those corrections.
I would like to estimate, for lack of a better description,
a partially additive non-parametric model with the following
structure:
z~ f(x,y):w1 + g(x,y):w2 + e
In other words, I'd like to estimate the marginals with 
respect to
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 =
2012 Oct 27
0
[gam] [mgcv] Question in integrating a eiker-white "sandwich" VCV estimator into GAM
Dear List,
I'm just teaching myself semi-parametric techniques.  Apologies in 
advance for the long post.
I've got observational data and a longitudinal, semi-parametric model 
that I want to fit in GAM (or potentially something equivalent), and I'm 
not sure how to do it.  I'm posting this to ask whether it is possible 
to do what I want to do using "canned" commands
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
2003 Jun 03
3
gam questions
Dear all,
I'm a fairly new R user having two questions regarding gam:
1. The prediction example on p. 38 in the mgcv manual. In order to get 
predictions based on the original data set, by leaving out the 'newdata' 
argument ("newd" in the example), I get an error message
"Warning message: the condition has length > 1 and only the first element 
will be used in: if
2006 Jul 03
1
gamm
Hello,
   
  I am a bit confused about gamm in mgcv. Consulting Wood (2006) or Ruppert et al. (2003) hasn't taken away my confusion.
   
  In this code from the gamm help file:
   
     b2<-gamm(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson,random=list(fac=~1))
  Am I correct in assuming that we have a random intercept here....but that the amount of smoothing is also changing per level of the
2012 Jul 14
1
GAM Chi-Square Difference Test
We are using GAM in mgcv (Wood), relatively new users, and wonder if anyone
can advise us on a problem we are encountering as we analyze many short time
series datasets. For each dataset, we have four models, each with intercept,
predictor x (trend), z (treatment), and int (interaction between x and z).
Our models are 
Model 1: gama1.1 <- gam(y~x+z+int, family=quasipoisson) ##no smooths
Model
2012 Jan 16
1
GAM without intercept reports a huge deviance
Hi all,
I constructed a GAM model with a linear term and two smooth terms, all of
them statistically significant but the intercept was not significant. The
adjusted r2 of this model is 0.572 and the deviance 65.3.
I decided to run the model again without intercept, so I used in R the
following instruction:
regression= gam(dependent~ +linear_independent +s(smooth_independent_1)
2013 Apr 23
1
GAM Penalised Splines - Intercept
Hey all,
I'm using the gam() function inside the mgcv package to fit a penalised spline to some data. However, I don't quite understand what exactly the intercept it includes by default is / how to interpret it. 
Ideally I'd like to understand what the intercept is in terms of the B-Spline and/or truncated power series basis representation. 
Thanks!
2006 Mar 23
1
gam y-axis interpretation
Sorry if this is an obvious question...
 
I'm estimating a simple binomial generalized additive model using the
gam function in the package mgcv.  The model makes sense given my data,
and the predicted values also make sense given what I know about the
data.
 
However, I'm having trouble interpreting the y-axis of the plot of the
gam object.  The y-axis is labeled "s(x,2.52)"
2006 Dec 15
1
DF for GAM function (mgcv package)
For summary(GAM) in the mgcv package smooth the degrees of freedom for
the F value for test of smooth terms are the rank of covariance matrix
of \hat{beta} and the residuals df.  I've noticed that in a lot of GAMs
I've fit the rank of the covariance turns out to be 9.  In Simon Wood's
book, the rank of covariance matrix is usually either 9 or 99 (pages
239-230 and 259).  
 
Can anyone
2012 May 29
1
GAM interactions, by example
Dear all,
I'm using the mgcv library by Simon Wood to fit gam models with interactions and I have been reading (and running) the "factor 'by' variable example"   given on the gam.models help page (see below, output from the two first models b, and b1).
The example explains that both b and b1 fits are similar: "note that the preceding fit (here b) is the same as
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
2010 Jan 04
1
glmer (lme4), glmmPQL (MASS) and xtmepoisson (Stata)
Dear R users,
 
I'm trying to specify a generalized linear mixed model in R, basically a Poisson model to describe monthly series of counts in different regions.
My aim is to fit subject-specific curves, modelling a non-linear trend for each region through random effects for linear splines components (see Durban et al,  Stat Med 2005, or " Semiparametric regression" by Ruppert et al,
2010 Jun 30
1
Interpretation of gam intercept parameter
Dear All:
I apologize for asking such an elementary question, but I could not find an adequate response on line. I am hoping to receive some help with the interpretation of the Intercept coefficient in the gam model below.
 
I1 through I3 are dummy coded "Item difficulty" parameters in a data set that includes 4 items. If the Intercept is the value of Y when all other terms are 0, am I
2008 Jun 05
1
GAM hurdle models
Hello,
I have been using mgcv to run GAM hurdle models, analyzing 
presence/absence data with GAM logistic regressions, and then analyzing 
the data conditional on presence (e.g. without samples with no zeros) 
with GAMs with a negative binomial distribution.
It occurs to me that using the negative binomial distribution on data 
with no zeros is not right, as the negative binomial allows zeros.