similar to: setting constraints on gam

Displaying 20 results from an estimated 9000 matches similar to: "setting constraints on gam"

2018 Jan 12
1
setting constraints on gam
Thanks Simon, by cloning a smooth construct do you mean copying and modifying the smooth constructor code? Could you pleas elaborate on your answer? Which is the Predict.matrix method? 2018-01-12 3:20 GMT-06:00 Simon Wood <simon.wood at bath.edu>: > There probably is a way, but it involves some programming. You would need to > clone a smooth constructor (e.g. for the "cr"
2018 Jan 12
0
setting constraints on gam
There probably is a way, but it involves some programming. You would need to clone a smooth constructor (e.g. for the "cr" class), and then modify it to add a linear constraint matrix C to the returned smooth object. If b are the smooth coefficients then C should? be the matrix such that s(0) = Cb (you can get this from the Predict.matrix method for the class). Then the constraint
2017 Dec 14
1
GAM Poisson
Dear all, I apologize as this may not be a strictly R question. I am running GAM models using the mgcv package. I was wondering if the interpretation of the smooth splines of the 'x' variable is the same in the following two cases: # Linear probability model m1 <- gam(count ~ factor(city) + factor(year) + s(x), data=data,na.action=na.omit) # Poisson m2 <- gam(count ~ factor(city)
2016 Apr 27
1
Random effects in package mgcv
Hello R users, I have a quick question I was hoping to get your input on. I am new to R and the smooth statistical regression world, and am trying to wrap my mind around the issues concerning using splines for mixed effect modeling. My question is the following: in the ?gamm? function, generalized additive mixed models can be estimated by including random components. These can be explicitly
2012 Jul 30
2
mgcv 1.7-19, vis.gam(): "invalid 'z' limits'
Hi everyone, I ran a binomial GAM consisting of a tensor product of two continuous variables, a continuous parametric term and crossed random intercepts on a data set with 13,042 rows. When trying to plot the tensor product with vis.gam(), I get the following error message: Error in persp.default(m1, m2, z, col = col, zlim = c(min.z, max.z), xlab = view[1], : invalid 'z' limits In
2013 Jul 08
1
error in "predict.gam" used with "bam"
Hello everyone. I am doing a logistic gam (package mgcv) on a pretty large dataframe (130.000 cases with 100 variables). Because of that, the gam is fitted on a random subset of 10000. Now when I want to predict the values for the rest of the data, I get the following error: > gam.basis_alleakti.1.pr=predict(gam.basis_alleakti.1, +
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis. The following is the 'hierarchy' of models I would like to test: (1) Y_i = a + integral[ X_i(t)*Beta(t) dt ] (2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ] (3) Y_i = a + integral[ F{X_i(t),t} dt ] equivalents for discrete data might be: 1) Y_i = a + sum_t[ L_t * X_it * Beta_t ] (2) Y_i
2009 Jun 23
1
Model fitting with GAM and "by" term
Hello R Users, I have a question regarding fitting a model with GAM{mgcv}. I have data from several predictor (X) variables I wish to use to develop a model to predict one Y variable. I am working with ecological data, so have data collected many times (about 20) over the course of two years. Plotting data independently for each date there appears to be relationships between Y (fish density)
2013 Aug 23
1
Setting up 3D tensor product interactions in mgcv
Hi, I am trying to fit a smoothing model where there are three dimensions over which I can smooth (x,y,z). I expect interactions between some, or all, of these terms, and so I have set up my model as mdl <- gam(PA ~ s(x) + s(y) + s(z) + te(x,y) + te(x,z) + te(y,z) + te(x,y,z),...) I have recently read about the ti(), "tensor product interaction smoother", which takes care of these
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
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
2012 Jul 30
1
te( ) interactions and AIC model selection with GAM
Hello R users, I'm working with a time-series of several years and to analyze it, I?m using GAM smoothers from the package mgcv. I?m constructing models where zooplankton biomass (bm) is the dependent variable and the continuous explanatory variables are: -time in Julian days (t), to creat a long-term linear trend -Julian days of the year (t_year) to create an annual cycle - Mean temperature
2008 Nov 20
1
gam and ordination (vegan and labdsv surf and ordisurf)
I have a general question about using thin plate splines in the surf and ordisurf routines. My rudimentary knowledge of a gam is that with each predictive variable there is a different smooth for each one and then they are added together with no real interaction term (because they don't handle this well?). Now, If I have two variables that have a high D^2 score and a low GCV score (I am
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
2007 Nov 25
1
GAM with constraints
Hi, I am trying to build GAM with linear constraints, for a general link function, not only identity. If I understand it correctly, the function pcls() can solve the problem, if the smoothness penalties are given. What I need is to incorporate the constraints before calculating the penalties. Can this be done in R? Any help would be greately appreciated. -- View this message in context:
2009 Nov 21
1
3-D Plotting of predictions from GAM/GAMM object
Hello all, Thank you for the previous assistance I received from this listserve! My current question is: How can I create an appropriate matrix of values from a GAM (actually a GAMM) to make a 3-D plot? This model is fit as a tensor product spline of two predictors and I have used it to make specific predictions by calling:
2011 Sep 20
2
Multivariate spline regression and predicted values
Hello, I am trying to estimate a multivariate regression of Y on X with regression splines. Y is (nx1), and X is (nxd), with d>1. I assume the data is generated by some unknown regression function f(X), as in Y = f(X) + u, where u is some well-behaved regression error. I want to estimate f(X) via regression splines (tensor product splines). Then, I want to get the predicted values for some new
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 =