Displaying 20 results from an estimated 10000 matches similar to: "interrupting R"
2007 Oct 02
3
mcv package gamm function Error in chol(XVX + S)
Hi all R users !
I'm using gamm function from Simon Wood's mgcv package, to fit a spatial
regression Generalized Additive Mixed Model, as covariates I have the
geographical longitude and latitude locations of indexed data. I include a
random effect for each district (dist) so the code is
fit <- gamm(y~s(lon,lat,bs="tp", m=2)+offset(log(exp.)),
random=list(dist=~1),
2008 May 06
1
mgcv::gam shrinkage of smooths
In Dr. Wood's book on GAM, he suggests in section 4.1.6 that it might be
useful to shrink a single smooth by adding S=S+epsilon*I to the penalty
matrix S. The context was the need to be able to shrink the term to zero if
appropriate. I'd like to do this in order to shrink the coefficients towards
zero (irrespective of the penalty for "wiggliness") - but not necessarily
all the
2006 Nov 28
4
GAMS and Knots
Hi
I was wondering if anyone knew how to work out the number of knots that
should be applied to each variable when using gams in the mgcv library?
Any help or references would be much appreciated.
Thanks
Kathryn Baldwin
2011 Aug 16
0
Cubic splines in package "mgcv"
re: Cubic splines in package "mgcv"
I don't have access to Gu (2002) but clearly the function R(x,z) defined
on p126 of Simon Wood's book is piecewise quartic, not piecewise cubic.
Like Kunio Takezawa (below) I was puzzled by the word "cubic" on p126.
As Simon Wood writes, this basis is not actually used by mgcv when
specifying bs="cr".
Maybe the point is
2007 Dec 26
1
Cubic splines in package "mgcv"
R-users
E-mail: r-help@r-project.org
My understanding is that package "mgcv" is based on
"Generalized Additive Models: An Introduction with R (by Simon N. Wood)".
On the page 126 of this book, eq(3.4) looks a quartic equation with respect
to
"x", not a cubic equation. I am wondering if all routines which uses
cubic splines in mgcv are based on this quartic
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
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
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
2012 Jun 21
2
check.k function in mgcv packages
Hi,everyone,
I am studying the generalized additive model and employ the package 'mgcv'
developed by professor Wood.
However,I can not understand the example listed in check.in function.
For example,
library(mgcv)
set.seed(1)
dat <- gamSim(1,n=400,scale=2)
## fit a GAM with quite low `k'
b<-gam(y~s(x0,k=6)+s(x1,k=6)+s(x2,k=6)+s(x3,k=6),data=dat)
plot(b,pages=1,residuals=TRUE)
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
2011 Jun 07
2
gam() (in mgcv) with multiple interactions
Hi! I'm learning mgcv, and reading Simon Wood's book on GAMs, as recommended to me earlier by some folks on this list. I've run into a question to which I can't find the answer in his book, so I'm hoping somebody here knows.
My outcome variable is binary, so I'm doing a binomial fit with gam(). I have five independent variables, all continuous, all uniformly
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,
2010 Jun 16
3
mgcv, testing gamm vs lme, which degrees of freedom?
Dear all,
I am using the "mgcv" package by Simon Wood to estimate an additive mixed
model in which I assume normal distribution for the residuals. I would
like to test this model vs a standard parametric mixed model, such as the
ones which are possible to estimate with "lme".
Since the smoothing splines can be written as random effects, is it
correct to use an (approximate)
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
2008 Sep 03
1
Non-constant variance and non-Gaussian errors
Hi Paul,
Take a look at gam() from package mgcv (gam = generalized additive models), maybe this will help you. GAMs can work with other distributions as well. Generalized additive models consist of a random component, an additive component, and a link function relating these two components. The response Y, the random component, is assumed to have a density in the exponential family. I am not sure
2010 Dec 14
2
Use generalised additive model to plot curve
Readers,
I have been reading 'the r book' by Crawley and think that the
generalised additive model is appropriate for this problem. The
package 'gam' was installed using the command (as root)
install.package("gam")
...
library(gam)
> library(gam)
Loading required package: splines
Loading required package: akima
> library(mgcv)
This is mgcv 1.3-25
Attaching
2007 Oct 03
1
How to avoid overfitting in gam(mgcv)
Dear listers,
I'm using gam(from mgcv) for semi-parametric regression on small and
noisy datasets(10 to 200
observations), and facing a problem of overfitting.
According to the book(Simon N. Wood / Generalized Additive Models: An
Introduction with R), it is
suggested to avoid overfitting by inflating the effective degrees of
freedom in GCV evaluation with
increased "gamma"
2012 Apr 02
1
gamm: tensor product and interaction
Hi list,
I'm working with gamm models of this sort, using Simon Wood's mgcv library:
gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1))
gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1))
with a dataset of about 70000 rows and 110 levels for Group
in order to test whether tensor product smooths vary across factor levels. I was wondering if comparing those two
2010 Aug 04
2
more questions on gam/gamm(mgcv)...
Hi R-users,
I'm using R 2.11.1, mgcv 1.6-2 to fit a generalized additive mixed model.
I'm new to this package...and just got more and more problems...
1. Can I include correlation and/or random effect into gam( ) also? or only
gamm( ) could be used?
2. I want to estimate the smoothing function s(x) under each level of
treatment. i.e. different s(x) in each level of treatment. shall I
2011 Jun 21
5
please help for mgcv package
i read a book from WOOD, there's an example which is talking about the
pollutant.
library(gamair)
library(mgcv)
y<-gam(death~s(time,bs="cr",k=200)+s(pm10median,bs="cr")+s(so2median,bs="cr")+s(o3median,bs="cr")+s(tmpd,bs="cr"),data=chicago,family=Possion)
lag.sum<-function(a,10,11)
{n<-length(a)
b<-rep(0,n-11)
for(i in 0:(11-10))