Re: [R] NaN response with gam (mgcv library)

2023-05-01 Thread Simon Wood
ented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Edinburgh, https://www.maths.ed.ac.uk/~swood34/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-h

Re: [R] mgcv: relative risk from GAM with distributed lag

2022-07-22 Thread Simon Wood
On 21/07/2022 15:19, jade.shodan--- via R-help wrote: Hello everyone (incl. Simon Wood?), I'm not sure that my original question (see below, including reproducible example) was as clear as it could have been. To clarify, what I would to like to get is: 1) a perspective plot of temperat

Re: [R] High concurvity/ collinearity between time and temperature in GAM predicting deaths but low ACF. Does this matter?

2022-06-08 Thread Simon Wood
= 1 n = 5107 ``` ACF functions: [4]: https://i.stack.imgur.com/7nbXS.png [5]: https://i.stack.imgur.com/pNnZU.png Data can be found on my [GitHub][6] site in the file [data_cross_validated_post2.rds][7]. A csv version is also available. This is my code: ```r library(readr) library(m

Re: [R] mgcv::gam() scale parameter estimates for quasibinomial error models

2021-04-15 Thread Simon Wood
d, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Edinburgh, https://www.maths.ed.ac.uk/~swood34/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo

Re: [R] FW: problem with markov random field smooths in mgcv

2020-03-24 Thread Simon Wood
and in particular I am getting the message Error in initial.sp(w * x, S, off) : S[[1]] matrix is not +ve definite. After reading everything I could find on mrf, it sounds like there was a bug that was brought up with Simon Wood in 2012, due to differences between windows and

Re: [R] ref.df in mgcv gam

2019-03-27 Thread Simon Wood
SN. On p-values for smooth components of an extended generalized additive model. Biometrika 2013;100(1):221-228 or thereafter, but I am not a statistician. I could use help understanding what the reference degrees of freedom are. Thank you, Susan -- Simon Wood, School of Mathematics, Univer

Re: [R] [mgcv] Memory issues with bam() on computer cluster

2019-03-15 Thread Simon Wood
ge, could you > pinpoint us to where the problem may occur? Is it something within the C-code > used within the package (as the last error seems to indicate), or is it > related to the computer cluster? > > Any help or insights is much appreciated. > > Kind regards, > > Frank > > [[alternative HTML version deleted

Re: [R] Quoting smooth random terms mccv::gam

2018-12-17 Thread Simon Wood
I would quote the p-value, but not the statistic (as it is not a standard F stat). The actual statistic is given here: https://academic.oup.com/biomet/article-pdf/100/4/1005/566200/ast038.pdf On 14/12/2018 04:33, Smith, Desmond wrote: Dear All, I have a mgcv::gam model of the form: m1 <- gam

Re: [R] MGCV:: boundary conditions in gam

2018-11-08 Thread Simon Wood
This first derivative penalty spline will do it, but the price paid is that the curves are often quite wiggly. library(mgcv); set.seed(5) x <- runif(100); y <- x^4 + rnorm(100)*.1 b <- gam(y~s(x,m=1)) pd <- data.frame(x=seq(-.5,1.5,length=200)) ff <- predict(b,pd,se=TRUE) plot(x,y,xlim=c(-

Re: [R] Why do two different calls to mgcv::gamm give different p-values?

2018-10-02 Thread Simon Wood
Dear Øystein, In your code 'id' is set up to be numeric. In your first gamm call it gets coerced to a factor (since nothing else would make sense). In  your second gamm call it is simply treated as numeric, since that could makes sense. To make the two models equivalent you just need to substi

Re: [R] setting constraints on gam

2018-01-12 Thread Simon Wood
_ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathemati

Re: [R] GAM Poisson

2018-01-11 Thread Simon Wood
ww.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 __ R-help@r-project.

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
d curves using predict(gamm1$gam,..., type="terms") supplying the factor levels and correctedAges at which you want to evaluate the curves. > Many thanks! > L > > > > On Thu, Apr 6, 2017 at 8:22 AM, Simon Wood <mailto:simon.w...@bath.edu>> wrote: > >

Re: [R] plotting gam plots from mgcv package

2017-04-06 Thread Simon Wood
d provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 __ R-help@r-project.org mailing list -- To UNS

Re: [R] conditional regression with mgcv

2017-04-06 Thread Simon Wood
rsion deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
ge: "Note that smooth ids are not supported for random effect terms. Unlike most smooth terms, side conditions are never applied to random effect terms in the event of nesting (since they are identifiable without side conditions)." When I do a search on "using gam mgcv formu

Re: [R] Theta in Negative binomial GAM

2017-02-27 Thread Simon Wood
___ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Schoo

Re: [R] GAM with the negative binomial distribution: why do predictions no match with original values?

2016-11-23 Thread Simon Wood
mailman/listinfo/r-help > thz.ch/mailman/listinfo/r-help> > stat.ethz.ch > The main R mailing list, for announcements about the development of R and the > availability of new code, questions and answers about problems and solutions > using R ... > > > >>> PLEASE do read the

Re: [R] mgcv: bam(), error in models with random intercepts and random slopes

2016-09-22 Thread Simon Wood
;re") + s(ctrial, sbj, bs="re") , data=data_a, family=binomial) Error in G$smooth[[i]]$first.para:G$smooth[[i]]$last.para : argument of length 0 Any idea on what that error might be? Thank you in advance for your time. Fotis P.S.: R version: 3.3.1, mgcv version: 1.8.15

Re: [R] mgcv: bam(), error in models with random intercepts and random slopes

2016-09-21 Thread Simon Wood
s(ctrial, sbj, bs="re") , data=data_a, family=binomial) Error in G$smooth[[i]]$first.para:G$smooth[[i]]$last.para : argument of length 0 Any idea on what that error might be? Thank you in advance for your time. Fotis P.S.: R version: 3.3.1, mgcv version: 1.8.15 -- Simon

Re: [R] mgcv::gam(): NA parametric coefficient in a model with two categorical variables + model interpretation

2016-05-23 Thread Simon Wood
for (A)? Is it the reference level? Or is it, perhaps, the "grand mean" of the shape variable? Thank you in advance for your time, Fotis -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190

Re: [R] gam.check() NA results (k-index, p-value) of a gam logistic regression model

2016-05-18 Thread Simon Wood
iling list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW

Re: [R] physical constraint with gam

2016-05-14 Thread Simon Wood
(x2,by=x2) since interactions are surely present and > i'm not sure if a linear combination is enough. > > Thanks! > Dominik > > > On Wed, May 11, 2016 at 3:11 AM, Simon Wood <mailto:simon.w...@bath.edu>> wrote: > > The spline hav

Re: [R] physical constraint with gam

2016-05-13 Thread Simon Wood
27;d probably use te(x1,x2) unless x1 and x2 are really on the same scale, in which case s(x1,x2) might be appropriate. The `by' variable trick is probably not going to work so well for interactions, however (it's not so clear what the by variable should be). -- Simon Wood, School

Re: [R] physical constraint with gam

2016-05-11 Thread Simon Wood
SE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 ___

Re: [R] Random effects in package mgcv

2016-04-28 Thread Simon Wood
ing-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 __ R-help@r-project.org maili

Re: [R] Error message when running gam (mgcv). object not found

2015-12-11 Thread Simon Wood
iated. Thank you very much. Best Diego -- Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Problem with binomial gam{mgcv}

2015-10-13 Thread Simon Wood
, Erin Conlisk __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, re

Re: [R] Is there a convenient way of extracting the matrix `solve(X %*% t(X) + PENALTY)` from an additive model fit in mgcv?

2015-06-18 Thread Simon Wood
info/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://pe

Re: [R] How to make new predictions from a GAM with a spline forced through the origin

2015-06-01 Thread Simon Wood
rsion deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-con

Re: [R] Robust GAM that covers Gaussian Distributions

2015-02-25 Thread Simon Wood
m/ilapros/DoubleRobGam Best Ilaria __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained,

Re: [R] Proportion data GAM

2014-10-15 Thread Simon Wood
Cetáceos - UFRRJ/ IF/ DCA 2014-10-15 15:22 GMT-04:00 Simon Wood mailto:s.w...@bath.ac.uk>>: Can you give the result of typing sessionInfo() in the session where this happens, please? On 15/10/14 16:48, Rodrigo Tardin wrote: Hi all, I am not sure if this is

Re: [R] Proportion data GAM

2014-10-15 Thread Simon Wood
[[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, M

Re: [R] bam (mgcv) not using the specified number of cores

2014-08-25 Thread Simon Wood
oops, I just realised that the fix referred to below is in mgcv 1.8-3 - not yet on CRAN. On 25/08/14 13:20, Simon Wood wrote: Hi Andrew, In some of the shots you sent then top was reporting several cores working. I think the problem here may be to do with the way bam is parallelized - at

Re: [R] bam (mgcv) not using the specified number of cores

2014-08-25 Thread Simon Wood
Thanks, Andrew __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simo

Re: [R] bam (mgcv) not using the specified number of cores

2014-08-21 Thread Simon Wood
list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603

Re: [R] GAM model output error(?)

2014-07-16 Thread Simon Wood
k of convergence warnings but then the model saying it was not converged and vice versa. The QP seemed to fit the data well (and quickly) so we switched to that. Thanks again. Trevor On Wed, Jul 16, 2014 at 12:44 PM, Simon Wood mailto:s.w...@bath.ac.uk>> wrote: Trevor, It looks li

Re: [R] GAM model output error(?)

2014-07-16 Thread Simon Wood
R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University

Re: [R] gamm4 and lme4 error

2014-07-14 Thread Simon Wood
g/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __ R-help@r-project.or

Re: [R] mgcv: BAM convergence conflicting messages

2014-06-18 Thread Simon Wood
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44

Re: [R] mgcv: I can't manually reconstruct a P-spline from a GAM's coefficients

2014-06-18 Thread Simon Wood
th[[1]]$knots, coef(my_gam)[-1], mm) plot(my_gam) lines(x,spline_y) # why is this different? It seems shifted on the x- and y-axis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and prov

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Simon Wood
b$xy.idx) nb$E <- factor(sprintf(id.fmt,nb$x.idx+1,nb$y.idx),levels=nb$xy.idx) nb$W <- factor(sprintf(id.fmt,nb$x.idx-1,nb$y.idx),levels=nb$xy.idx) nb.mat <- sapply(nb[,c("N","S","E","W")],as.numeric) nb.l <- lapply(split(nb.mat,nb$xy.idx),functio

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Simon Wood
)) [1] TRUE Any suggestions where to start? Mark [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-co

Re: [R] Seeking well-commented versions of mgcv source code

2014-05-07 Thread Simon Wood
I'm looking for well-commented versions of various functions comprising mgcv, Commented versions are available e.g. in mgcv_*.*-**.tar.gz from CRAN (unzip and look in mgcv/R). Well commented versions is another matter... best, Simon -- Simon Wood, Mathematical Science, University of Bat

Re: [R] mgcv::gam.check qq plot residuals are not standardized?

2014-04-25 Thread Simon Wood
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __

Re: [R] smooth spline with R

2014-03-17 Thread Simon Wood
ted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon W

Re: [R] GLM vs GAM

2014-03-14 Thread Simon Wood
tinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw28

Re: [R] Zero-dose constraint in modeling dose-response curves with gam

2014-03-07 Thread Simon Wood
_ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University o

Re: [R] gamm design matrices

2014-03-03 Thread Simon Wood
ise the smooth terms as a mixed model as Simon Wood neatly explains in his book. Given the original design matrix W and penalisation matrix S, I would like to find the fixed (X) and random (Z) design matrices for the mixed model parameteristaion. X are the columns of W for which S has zero eigenv

Re: [R] mgcv: distribution of dev with Poisson data

2014-02-05 Thread Simon Wood
on") dev1c[j]=m1$dev dev2c[j]=m2$dev } mean(sumsc) sd(sumsc) mean(dev1c) sd(dev1c) mean(dev2c) sd(dev2c) #dev much lower than expected m1q<-gam(y~s(x1),family="quasipoisson",scale=-1) m1q$scale m1q$sig2 m1q$dev/(1000-sum(m1q$edf)) #scale estimate < 1 sum((y-fitted(m1q)

Re: [R] mgcv: distribution of dev with Poisson data

2014-02-05 Thread Simon Wood
) #dev much lower than expected m1q<-gam(y~s(x1),family="quasipoisson",scale=-1) m1q$scale m1q$sig2 m1q$dev/(1000-sum(m1q$edf)) #scale estimate < 1 sum((y-fitted(m1q))^2/fitted(m1q))/(1000-sum(m1q$edf)) #Pearson estimate of scale ok -- Simon Wood, Mathematical Science, Univers

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-02-03 Thread Simon Wood
d Mac OS X): R version 3.0.2 (2013-09-25) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] mgcv_1.7-28

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-02-03 Thread Simon Wood
. But I think the error might be helpful in alerting one to the problems with the model. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __ R-help@r-project.org mailing

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-01-31 Thread Simon Wood
l and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __ R-help@r-project.org mailing list https://stat.et

Re: [R] log transforming predictor variables in a binomial GAM?

2013-12-16 Thread Simon Wood
version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathe

Re: [R] significance of random effect in mgcv gam

2013-12-04 Thread Simon Wood
.97816911 1.4484316 Rank: 2/2 Question. Am I correct that p = .126 above can be taken as the p-value associated with the random effect? Thanks. Will Shadish -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283

Re: [R] Negative binomial parameterisation in mgcv

2013-11-13 Thread Simon Wood
nfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.a

Re: [R] Nonnormal Residuals and GAMs

2013-11-07 Thread Simon Wood
lman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.b

Re: [R] Heteroscedasticity and mgcv.

2013-10-29 Thread Simon Wood
elp@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 3

Re: [R] Inscrutable error message in mgcv: 1> prediction = predict(MI, se.fit=TRUE, newdata=rhc), Error in if (object$inter) X[[i]] <- PredictMat(object$margin[[i]], dat, : , argument is of length zer

2013-10-29 Thread Simon Wood
@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386

Re: [R] Comparing two GAMs using anova (mgcv)

2013-09-23 Thread Simon Wood
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, Univers

Re: [R] Help with using unpenalised te smooth in negative binomial mgcv gam

2013-07-24 Thread Simon Wood
Hi Alice, This is a bug in gam.side, which was assuming that any interaction smooth that needed identifiability constraints would be penalized. thanks for reporting it - fixed for next version. In the meantime have you considered using `ti' terms instead of `te'? These provide a more satisfa

Re: [R] mgcv: pcls() makes everything linear

2013-07-23 Thread Simon Wood
I can't see anything immediately wrong except: 1. presumably there are repeated values in 'road_quiet' aren't there? If so then your inequality constraint matrix will contain constraints that are *exact* copies of each other. I'm not sure, and don't immediately have time to try it out, but it c

Re: [R] MGCV: overlay fitted (marginal) curves over a plot of the original data

2013-07-16 Thread Simon Wood
Probably you didn't want to set x0=0:1? Here is some code, to do what you want. (The CI shape is not identical to the plot(b) version as the uncertainty includes the uncertainty in the other smooths and the intercept now.) library(mgcv) set.seed(2) dat <- gamSim(1,n=400,dist="normal",scale=2) b

Re: [R] mgcv: GAM with clustered standard errors

2013-07-11 Thread Simon Wood
I think it's going to be a problem to have different sized groups in your second model. ?corSymm says that a general correlation matrix is being estimated (i.e. the correlation between each pair of observations is being estimated - for this to be meaningful across groups you need the jth price

Re: [R] error in "predict.gam" used with "bam"

2013-07-09 Thread Simon Wood
sion.string R version 3.0.1 (2013-05-16) nickname Good Sport package mgcv version 1.7-22 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid

Re: [R] mgcv summary.gam

2013-06-21 Thread Simon Wood
le parameter estimate or a signal of fixed scale parameter, to be passed to testStat. > 2) what is testStat? mgcv:::testStat - probably worth looking at the original source code which includes some comments. It does the actual computation. best, Simon > thanks > > Greg > >

Re: [R] Can you use two offsets in gam (mgcv)?

2013-06-17 Thread Simon Wood
help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproduc

Re: [R] gamm in mgcv random effect significance

2013-06-11 Thread Simon Wood
I would be very nervous about relying on an anova call here. It will attempt a generalized likelihood ratio test, but gamm is using penalized quasi likelihood and there is really no likelihood here (even without the problem that if there was a likelihood the null hypothesis would still be on th

Re: [R] gam (mgcv), multiple imputation, f-stats/p-values, and summary(gam)

2013-05-08 Thread Simon Wood
a gam object are called up? My harder question: how might one construct principled analogs of these statistics in an MI context, when degrees of freedom will vary across models, depending on the imputed data? Has anybody thought about this, or do I have have some serious pencil-and-paper

Re: [R] mgcv: how select significant predictor vars when using gam(...select=TRUE) using automatic optimization

2013-04-18 Thread Simon Wood
, family=Tweedie(p=1.6,link=log),data=df,method="REML") gives a model that is closer to being reasonable (p-values are then consistent between select=TRUE and FALSE). best, Simon On 18/04/13 14:24, Simon Wood wrote: Jan, Thanks for this. Is there any chance that you could send me th

Re: [R] mgcv: how select significant predictor vars when using gam(...select=TRUE) using automatic optimization

2013-04-18 Thread Simon Wood
ailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw28

Re: [R] mgcv: how select significant predictor vars when using gam(...select=TRUE) using automatic optimization

2013-04-17 Thread Simon Wood
ble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Understanding why a GAM can't suppress an intercept

2013-04-17 Thread Simon Wood
quot; formula specification work if it doesn't work "as intended" by for example lm? Many thanks, Andrew [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Time trends with GAM

2013-03-26 Thread Simon Wood
ailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University

Re: [R] Use pcls in "mgcv" package to achieve constrained cubic spline

2013-03-26 Thread Simon Wood
nfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __

Re: [R] Constrained cubic smoothing spline

2013-03-05 Thread Simon Wood
osting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 _

Re: [R] Why are the number of coefficients varying? [mgcv][gam]

2013-01-29 Thread Simon Wood
Andrew, I think that the weird edfs may result from an unhandled case in the side constraint calculation. In particular the term s(BCAR.imp,bs="cr",k=length(BCAR.knots),by=as.factor(pot.trial)) is confounded with te(soc.imp,BCAR.imp,k=c(4,4)) but there was an issue with picking this up prop

Re: [R] Why are the number of coefficients varying? [mgcv][gam]

2013-01-27 Thread Simon Wood
knots,soc.imp=soc.knots,sand.imp=sand.knots,clay.imp=clay.knots, abslat.imp=abslat.knots ) ,method = "REML" ,weights = 1/nsame ), error=function(e) e, finally=doyee) if(inherits(r.ints, "error")) {r.ints=doyee; print("an error hap

Re: [R] [mgcv][gam] Problem defining axis labels for non-smooth terms (via termplot)

2012-12-20 Thread Simon Wood
ther = sin(z) fit = gam(y~s(x)+s(z)+other) plot(fit,all.terms=TRUE) plot(fit,select=3,xlab="???") dev.copy2pdf(file = "This.pdf.needs.proper.labels.pdf", height = 8, width = 8) Any ideas for workarounds? Many thanks as always, Andrew -- Simon Wood, Mathematical Science,

Re: [R] Negative Binomial GAMM - theta values and convergence

2012-12-07 Thread Simon Wood
m filtering. As such individual emails may be examined in more detail. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, mini

Re: [R] gamcheck doubts

2012-12-06 Thread Simon Wood
sting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/

Re: [R] [mgcv][gam] Manually defining my own knots?

2012-12-03 Thread Simon Wood
ed.models dumb.example2$Vp = changed.vcv plot(dumb.example2,ylim=c(-500,200)) The confidence bands expand but the location of the fit doesn't change! What part of the gamObject controls the plot of the smooth? On 12/02/2012 02:15 AM, Simon Wood wrote: Hi Andrew, mgcv matches the knots

Re: [R] [mgcv][gam] Manually defining my own knots?

2012-12-02 Thread Simon Wood
Hi Andrew, mgcv matches the knots to the smooth arguments by name. If an element of 'knots' has no name it will be ignored. The following will do what you want... dumb.example = gam(y~s(x,k=3),knots=list(x=dumb.knots)) best, Simon On 29/11/12 23:44, Andrew Crane-Droesch wrote: Dear List, I'

Re: [R] Plot with residuals in mgcv

2012-11-29 Thread Simon Wood
Hi Silje, Thanks for this. I guess RUTE is a numeric variable in this model and hence only has one associated random coefficient? This then causes a problem when calling predict.gam as part of processing 'residuals=T'. I've fixed the problem for the next release, but did you really want a sin

Re: [R] interactions in GAMs

2012-11-27 Thread Simon Wood
ide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __ R-help@r-project.org mailing list https://

Re: [R] Help with graphics in gamm4 library

2012-11-27 Thread Simon Wood
ad the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __

Re: [R] gam (mgcv) problem: Error in while (mean(ldxx/(ldxx + ldss)) > 0.4) { :, missing value where TRUE/FALSE needed

2012-10-16 Thread Simon Wood
Hi Andrew, Could you send me a bit more information (off list, as this is likely to get into obscure details), please? In particular can you let me know the mgcv and R version numbers, the server operating system and, if possible, what BLAS it has installed? best, Simon On 16/10/12 07:32, An

Re: [R] gam (mgcv) problem: Error in while (mean(ldxx/(ldxx + ldss)) > 0.4) { :, missing value where TRUE/FALSE needed

2012-10-16 Thread Simon Wood
On 16/10/12 07:32, Andrew Crane-Droesch wrote: Hi All, I'm running into a problem with GAM (in the MGCV package). When I try to estimate the model, I get the following error message: 1> fit <- gam(ndvi~s(rain)+s(temp)+s(rainl1)+s(rainl2)+s(rainxY)+s(rainl1xY)+s(rainl2xY)+s(tempxY),

Re: [R] GAM without intercept

2012-10-12 Thread Simon Wood
ly I missunderstanding some key elements in gam modelling or using incorrect syntaxis. I don't know what the problem is. Any ideas will be helpful. Sergio -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw2

Re: [R] gam error message: matrix not +ve definite

2012-10-08 Thread Simon Wood
g guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __

Re: [R] [Fwd: REML - quasipoisson]

2012-10-01 Thread Simon Wood
which makes this work? f<-function(t) (Dpq/(2*t) + F3q + Mp/2*log(2*pi*t) - m3$gcv)^2 optimise(f,interval=c(0.5,1.5))$min->phix Dpq/(2*phix) + F3q + Mp/2*log(2*pi*phix) m3$gcv #but what is phix - not the Pearson estimate or the scale returned by gam? thanks Greg Dropkin -- Simon Woo

Re: [R] plotting smoother function on raw data

2012-09-14 Thread Simon Wood
Well it's not pretty, but I guess you could try something like this... best, simon library(mgcv) dat <- gamSim(1,n=200,dist="normal",scale=2) b <- gam(y ~ s(x1)+s(x2),data=dat) m <- 40 x1 <- seq(0,1,length=m) x2 <- seq(0,1,length=m) pd <- expand.grid(x1=x1,x2=x2) fv <- predict(b,newdata=pd,se=TRU

Re: [R] mgcv package, problems with NAs in gam

2012-08-25 Thread Simon Wood
'gam' doesn't know what to do with the model formula '1 ~ 1' (i.e. "one tilde one"). What is it supposed to mean? 'glm' also does nothing meaningful in this case... ## code to load you data file into 'dat' omitted > model<-glm(1~1, data=dat) > model Call: glm(formula = 1 ~ 1, data = dat) Co

Re: [R] Random effects in gam (mgcv 1.7-19)

2012-08-24 Thread Simon Wood
e.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 __ R-help@r-project.org mailing list https:

Re: [R] te( ) interactions and AIC model selection with GAM

2012-08-02 Thread Simon Wood
e: Simon, could you clarify this paragraph. We are submitting to a psychology journal and I am certain they will be asking us about why it is still ok to use AIC for non-nested models. Thanks. Will Shadish On 8/2/2012 9:49 AM, Simon Wood wrote: For AIC model comparison, the usual advice appli

Re: [R] te( ) interactions and AIC model selection with GAM

2012-08-02 Thread Simon Wood
osting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 ___

Re: [R] mgcv 1.7-19, vis.gam(): "invalid 'z' limits'

2012-07-30 Thread Simon Wood
Jan, Could you send the exact gam call and exact vis.gam call that did this please? Also, if 'm' denotes your fitted model, what result does 'fitted(m)' give? and what is the output from print(m)? best, Simon On 07/30/2012 09:19 PM, janvanhove wrote: Hi everyone, I ran a binomial GAM consi

Re: [R] mgcv: Extract random effects from gam model

2012-07-23 Thread Simon Wood
gam-model-tp4637415.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, min

Re: [R] mgcv: inclusion of random intercept in model - based on p-value of smooth or anova?

2012-07-19 Thread Simon Wood
ution of the test statistic... Thanks for pushing be into action on this! best, Simon On 25/06/12 16:31, Simon Wood wrote: Martin, I had a nagging feeling that there must be more to this than my previous reply suggested, and have been digging a bit further. Basically I would expect these p-v

  1   2   3   >