Displaying 20 results from an estimated 20000 matches similar to: "Part-Time R Help"
2013 Apr 20
0
Calculate confidence intervals in mgcv for unconditional on the, smoothing parameters
Dear R-Help members,
I am using Simon Wood`s mgcv package version1.7-22and R version 3.0.0
(2013-04-03) for fitting a GAM-Model to the LIDAR Data contained in the
"SemiPar" package. Here is the code for fitting the model and for
plotting the result:
data("lidar")
attach(lidar)
###
# mgcv fitting
###
gam_fit <- gam(logratio ~ s(range, k = 40, bs = "cr"), gamma
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
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
2011 Apr 19
1
Prediction interval with GAM?
Hello,
Is it possible to estimate prediction interval using GAM? I looked through
?gam, ?predict.gam etc and the mgcv.pdf Simon Wood. I found it can
calculate confidence interval but not clear if I can get it to calculate
prediction interval. I read "Inference for GAMs is difficult and somewhat
contentious." in Kuhnert and Venable An Introduction to R, and wondering why
and if that
2008 Apr 09
1
mgcv::predict.gam lpmatrix for prediction outside of R
This is in regards to the suggested use of type="lpmatrix" in the
documentation for mgcv::predict.gam. Could one not get the same result more
simply by using type="terms" and interpolating each term directly? What is
the advantage of the lpmatrix approach for prediction outside R? Thanks.
--
View this message in context:
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
2010 Jun 27
1
mgcv out of memory
Hello, I am trying to update the mgcv package on my Linux box and I keep
getting an "Out of memory!" error. Does anyone know of a fix for this?
Below is a snippet of the message that I keep getting: Thank you. Geoff
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
>>> Building/Updating help pages for package 'mgcv'
Formats:
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 :
2010 Sep 29
0
caret package version 4.63
Version 4.63 of the caret package is now on CRAN.
caret can be used to tune the parameters of predictive models using
resampling, estimate variable importance and visualize the results.
There are also various modeling and "helper" functions that can be
useful for training models.
caret has wrappers to over 99 different models for classification
and regression. See the package vignettes
2010 Sep 29
0
caret package version 4.63
Version 4.63 of the caret package is now on CRAN.
caret can be used to tune the parameters of predictive models using
resampling, estimate variable importance and visualize the results.
There are also various modeling and "helper" functions that can be
useful for training models.
caret has wrappers to over 99 different models for classification
and regression. See the package vignettes
2008 Oct 01
1
Simon Wood GAMsetup
Dear Simon, Thank you for your quick reply!
I used to perform the GAMsetup in the following manner:
GAMsetup sintax:
x.summer: vector used for construct the spline
knots<-14
N<-length(x.summer)
x<-array(x.summer,dim=c(1,N))
G<-list(m=1,n=N,nsdf=0,df=knots+1,dim=1,s.type=0,by=0,by.exists=FALSE,p.order=0,x=x,n.knots=knots,fit.method="mgcv")
H<-GAMsetup(G)
with the
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 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 Jun 29
0
modify tick labels in 3D GAM plot
Hello,
I have a GAM plot in 3D which was generated from the mgcv package
(plot.gam) which seems to call the persp( ) function from graphics.
This plot is one of three being plotted in the graphics window to copy
to a manuscript. The plot's rotation has been set to clearly show the
response surface generated in GAM. The resulting plot is small enough
that the tick labels overlap tick
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 <-
2004 Sep 03
1
how to debug a sudden exit in non-interactive mode
Hi,
I have a piece of R code that calls mgcv::gam. The code runs fine in the
interactive mode, but terminates R w/o a single message when run
non-interactively. Though I think I should be able to locate the problem
by brute force I'd appreciate an advise how to do it more intelligently
using R debugging tools.
At this time I only know that it has something to do with me loading my
custom
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
2013 Dec 05
0
mgcv gam modeling trend variation over cases
Dear R-Helpers,
I posted two days ago on testing significance of random effects in mgcv,
but realize I did not make my overall purpose clear. I have a series of
N short time series, where N might range from 3-10 and short means a
median of 20 time points. The sample data below (PCP) has N = 4 cases
with 9, 13, 16 and 16 observations over time respectively. The data set
contains four
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)