Displaying 20 results from an estimated 5000 matches similar to: "GAM Penalised Splines - Intercept"
2011 Dec 16
1
mgcv 1.7-12 crashes R
Dear community,
I encountered a very disturbing phenomenon today:
When I try to fit any gam() with mgcv R aborts. I could not find any post
regarding this in google, which mades in even more strange.
I am using the latest Ubuntu, latest R and latest mgcv everything up to
date. The crash occured too with the last mgcv 1.7-11.
This is the output from the R shell:
<pre>
R version 2.14.0
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 =
2010 Oct 27
1
GAM function in mgcv package
Hi R-users
 
I am trying to use the GAM function of the mgcv package. But I am having
problem trying to specify the k parameter.
 
Although I managed to run some models by giving to the parameter some
(random) value, and it is explained by Wood (2006) that it does not seem
to "really" affect the final result, I would like to grasp better its
meaning.
 
I understand that is the
2010 Mar 04
2
which coefficients for a gam(mgcv) model equation?
Dear users,
I am trying to show the equation (including coefficients from the model
estimates) for a gam model but do not understand how to.
Slide 7 from one of the authors presentations (gam-theory.pdf  URL: 
http://people.bath.ac.uk/sw283/mgcv/) shows a general equation
log{E(yi )} = ?+ ?xi + f (zi ) .
What I would like to do is put my model coefficients and present the
equation used. I am an
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)
 >
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
2016 Apr 26
0
Penalised spline regression
Good Afternoon Everyone,
I am looking for advice fitting a linear mixed model where the random components do not seem to fit within the model formulae for lmer. The columns of Z are not stratified and have the notional random formula (z1 | 1) + ... + (zk | 1). 
Context
I am fitting a penalised thin plate spline with knots k1 to kn. The basis functions Zk are |x-ki|^3 and the penalty matrix has
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 <- 
2008 Jul 01
1
Simulate from a GAM model
Does anybody have any suggestions on how I might simulate from fitted GAM 
model? I am using the gam function in the mgcv package to fit a variable 
coefficient model like the following from the examples. I would like simulate 
based on the fitted model like the simulate function in the stats package does 
for lm models.
library(mgcv)
set.seed(10)
## simulate date from y = f(x2)*x1 + error
dat
2010 Dec 08
1
I want to get smoothed splines by using the class gam
Hi all,
I try to interpolate a data set in the form:
time	Erg
0.000000	48.650000
1.500000	56.080000
3.000000	38.330000
4.500000	49.650000
6.000000	61.390000
7.500000	51.250000
9.000000	50.450000
10.500000	55.110000
12.000000	61.120000
18.000000	61.260000
24.000000	62.670000
36.000000	63.670000
48.000000	74.880000
I want to get smoothed splines by using the class gam
The first way I tried , was
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
2012 Sep 25
1
REML - quasipoisson
hi
I'm puzzled as to the relation between the REML score computed by gam and
the formula (4) on p.4 here:
http://opus.bath.ac.uk/22707/1/Wood_JRSSB_2011_73_1_3.pdf
I'm ok with this for poisson, or for quasipoisson when phi=1.
However, when phi differs from 1, I'm stuck.
#simulate some data
library(mgcv)
set.seed(1)
x1<-runif(500)
x2<-rnorm(500)
2013 Apr 16
2
Understanding why a GAM can't have an intercept
Dear List,
I've just tried to specify a GAM without an intercept -- I've got one of 
the (rare) cases where it is appropriate for E(y) -> 0 as X ->0.  
Naively running a GAM with the "-1" appended to the formula and the 
calling "predict.gam", I see that the model isn't behaving as expected.
I don't understand why this would be.  Google turns up this old
2011 Feb 16
1
retrieving partial residuals of gam fit (mgcv)
Dear list,
does anybody know whether there is a way to easily retrieve the so called "partial residuals" of a gam fit with package mgcv? The partial residuals are the residuals you would get if you would "leave out" a particular predictor and are the dots in the plots created by
plot(gam.object,residuals=TRUE)
residuals.gam() gives me whole model residuals and
2003 Jan 09
2
GAM with Thin plate splines
Hello, I'm a student at the University of Klagenfurt / Austria and I 
need some help !
I have to predict 24 daily load-values.
Therefor I got a dataset with following colums:
24 past daily load-values
6  past daily temperature-values
My goal is to find a model (GAM with thin plate splines) in R.
I found the function "gam" in the R-library "mgcv", but it just fits 
2003 Sep 16
2
gam and concurvity
Hello, 
in the paper "Avoiding the effects of concurvity in GAM's .." of Figueiras et 
al. (2003) it is mentioned that in GLM collinearity is taken into account in 
the calc of se but not in GAM (-> results in confidence interval too narrow, 
p-value understated,  GAM S-Plus version). I haven't found any references to 
GAM and concurvity or collinearity on the R page. And I
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
2
smoothing spline in package gam
dear all,
 
i have a little question, but it make me torment long time
 
hope you can help me and give some advices , thanks
 
 
i use smoothing spline in package gam
 
the model
 
> m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y05+y06+y07+y99+y98+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl))
and summary(m1) can show the "s"(smoothing) variables' Signif. codes.
2009 Oct 13
2
How to choose a proper smoothing spline in GAM of mgcv package?
Hi, there,
I have 5 datasets. I would like to choose a basis spline with same knots in
GAM function in order to obtain same basis function for 5 datasets.
Moreover, the basis spline is used to for an interaction of two covarites.
I used "cr" in one covariate, but it can only smooth w.r.t 1 covariate. Can
anyone give me some suggestion about how to choose a proper smoothing spline
2007 Jul 02
1
gam function & time trend splines
I've been doing a simple time-series analysis looking
at the relationship between daily pneumonia
hospitalizations and daily temperature.  To mimic some
of the literature, I've been including a time-trend to
try to account for normal cyclical trends in
hospitalization.  So I've been using a function that
looks something like this:
gam(pneucount ~ temp_f +