Questions tagged [gam]

GAM (Generalized Additive Model) is a statistical model used to combine Generalized Linear Models with Additive Models.

GAM (Generalized Additive Model) is a statistical model used to combine Generalized Linear models with Additive Models. It is found in both the CRAN packages gam and mgcv for the R language.

683 questions
0
votes
1 answer

Order of factor levels in termplot

I was wondering if you can reorder the factor levels in termplot, as they are currently in alphabetical order and I require them to be in chronological order. This was the code I used to create the plot: termplot(model2, rug=TRUE, se=T,…
jono33
  • 1
0
votes
1 answer

Unable to find predict in the mgcv package when using rpy2

I am using rpy2 to communicate with mgcv pkg, to get a gam prediction. I am able to get a gam fit by using the mgcv pkg, however when I try to use the predict method, it errors out with the error: NameError: name 'predict' is not defined Following…
P Ved
  • 109
  • 3
  • 13
0
votes
1 answer

vis.gam transparent at top of "persp" graph

I am running a GAMM using package mgcv. The model is running fine and gives an output that makes sense, but when I use vis.gam(plot.type="persp") my graph appears like this: enter image description here Why is this happening? When I use…
vermicellion
  • 338
  • 2
  • 14
0
votes
1 answer

Using Proc Logistic/Proc GAM

In my dataset the variables which are indicated by different range say Female_Age_Band are given as 15-20,20-25,25-30,...& so on.But the problem is wherever the data is unavailable that particular observation is labelled as "Unavailable" which is…
user6016731
  • 382
  • 5
  • 18
0
votes
0 answers

In the 'gam' package for R, what is the difference in purpose between the formulas supplied to gam and step.gam functions?

Trying to use gam::step.gam to build a model. Don't understand why that function asks for a formula if the input model object already has an embedded formula (from when it was fit via gam::gam) Why ask for the formula twice? When would I want to…
MCornejo
  • 327
  • 1
  • 12
0
votes
0 answers

How to determine sound choice of 'scale' when performing forward selection with gam::step.gam?

I want to use gam::step.gam with direction = forward. The help doc indicates that the default value of scale may not be a sound choice in this case. How do I determine a sound choice for scale?
MCornejo
  • 327
  • 1
  • 12
0
votes
1 answer

Defining gam function type

I would like to apply a gam model on a dataset with specifying the types of functions to use. It would be something like : y ~ cst1 * (s(var1)-s(var2)) * (1 - exp(var3*cst2)) s has to be the same function for both var1 and var2. I don't have a prior…
mhaddad
  • 119
  • 1
  • 10
0
votes
1 answer

Parallel foreach changes data to NA when running dropterm

I have a GAMLSS model I'm trying to fit to multiple subsets of my data. Each month needs to be analyzed separately, so I'm using a foreach loop to iterate through the months. However, when I parallelize my loop, the results of dropterm all get NA'd.…
0
votes
1 answer

Error in using by in R

I'm new to R and started using it to implement a gam model. I've been following this tutorial examples and R keeps throwing an error when I try to use by. I really have no idea what's wrong and would appreciate it if anybody can suggest…
words_of_wisdom
  • 163
  • 3
  • 16
0
votes
1 answer

mgcv::gamm() and MuMIn::dredge() errors

I've been trying to fit multiple GAMs using the package mgcv within a function, and crudely select the most appropriate model through model selection procedures. But my function runs the first model then doesn't seem to recognise the input data dat…
0
votes
1 answer

fit a smoothing spline using gam function

I want to fit a smoothing spline using gam function. An attempt to plot the fitted values is resulting in an error -object$nsdf? I am wondering if that is a needed input and if so what is df referring to? How to fix this code.…
Mary A. Marion
  • 780
  • 1
  • 8
  • 27
0
votes
1 answer

labeling axis for parametric terms with plot.gam

I am trying to plot my gam results. The plotting works very well for all the smooth terms (in my case terms 1 to 8) but if I want to plot parametric terms (from 9 onwards), I can't change the axis labels. No matter if I use plot, plot.gam, termplot…
Magda Chu
  • 13
  • 3
0
votes
1 answer

Font size in vis.gam

I have a GAM plot which was produced by vis.gam (mgvc package) and I´m trying to change font size, labels position and to set minor ticks (not essential but desirable) generated by ticktype="detailed". I found no option for this neither in the…
Juan Carlos
  • 173
  • 13
0
votes
0 answers

Fitting functional generalized additive model with "refund" package

I would like to fit a functional generalized additive model (with a scalar outcome and a functional predictor) where the outcome is regressed on an integral: \int F(X(t)) dt By default, the "refund" package in R assumes a more flexible form \int…
Aki
  • 155
  • 1
  • 2
  • 8
0
votes
1 answer

Error while using "micv" smooth function in predict.gam (mgcv)

While predicting for the GAM model with mgcv package, built using micv smooth function(from scam package) for one of the co-variates, I get the following error: Error in predict.gam(mod_gam, newdata = dfGAMDev) : number of items to replace is not…
mrbot
  • 63
  • 5