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

Calculate AUC and GAM and set a scale in R

I have a data form as follows: x y chla sst ssha eke tuna : : : : : : : : : : : : : : I used a GAM model as follows: GAM <- gam(tuna~s(chla), family = binomial, data = nonLinear) By…
ahmad
  • 21
  • 1
  • 5
0
votes
1 answer

Plotting gam model results in lattice

I am fitting a model using gam from the mgcv package. I am storing the result in model and so far I have been looking at the smooth components using plot(model). I have recently started using lattice and like its output. So I am wondering, is it…
user48386
  • 95
  • 1
  • 6
0
votes
1 answer

analyzing multiple dependent variables (different species same predictors) in a gam model using dlply

I am still in the learning curve of R (and new in this forum) and have been trying to loop a gam model where I tried to evaluate different responses (dependent variables - in this case fish species) to environmental predictors. So basically I want…
Rolo
  • 1
  • 2
0
votes
1 answer

Issue with predict function in R for one biostack and not another

I am doing species distribution modeling (ecological niche modeling) where I project a model to either current or future climate rasters (Bioclim variables). When I predict to the current rasters (object=bio_stack), everything works, using this…
user3545679
  • 181
  • 1
  • 12
0
votes
1 answer

Changing the colors in a contour plot from vis.gam in mgcv

I am using vis.gam() to plot the results of a model. The code is the following : vis.gam(model,view=c("CHLA","SST"),xlim=c(0,15),ylim=c(10,30),xlab="CHL-a (mg.m-3)",ylab="SST…
habasque
  • 31
  • 1
  • 5
0
votes
0 answers

How to create a 3d plot of spline with 3 covariates with R?

I've fitted a COZIGAM model, that is like a GAM model but for Zero-Inflated data. My model is: library(COZIGAM) t5.co<-cozigam(z1~s(y1, bs="cr")+s(lon1,lat1,sst1)+s(sst1,bs="cr"), conv.crit.out=1e-3, family=poisson, data=data1) How…
0
votes
0 answers

Multidimensional Gaussian in gam

I’ve been reading the documentations and discussions I can find but couldn’t get an answer, so I hope someone can help.   I want to use gam in the context of an optimization algorithm (EM). In a simpler scenario, if I wanted to fit a 1d Gaussian…
0
votes
1 answer

gwr fitting using package mgcv and R2Bayesx in R

I want to compare GWR fittings produced between spgwr and mgcv, but I got a error with gam function of mgcv . Here is a example : require(spgwr) require(mgcv) require(R2BayesX) data(columbus) col.bw <- gwr.sel(crime ~ income + housing,…
seifer_08ms
  • 375
  • 5
  • 17
0
votes
0 answers

constrain predictions within outer knots in mgcv::gam using R

I would like to fit a cubic spline using the gam function in mgcv package in R. Furthermore, I would like to constrain values outside of the training set (beyond the outer knots) to be equal to the nearest knot value. That is, no model prediction…
Alex
  • 19,533
  • 37
  • 126
  • 195
0
votes
0 answers

Fitting a spline to messy curves

I have trade off curves generated from a simulation where the points are not entirely smooth. I'd like to fit a spline and calculate the max. Due to the jagged nature of the points, especially near the peak, it doesn't make sense to fit a spline to…
Maiasaura
  • 32,226
  • 27
  • 104
  • 108
0
votes
1 answer

plotting correct values for gam model in r

I have the following example (which is in similar format to my data): set.seed(1) RandData <- runif(8760*2) Locations <- rep(c('UK','France'),each=8760) Date = seq(from=as.POSIXct("1991-01-01 00:00"), to=as.POSIXct("1991-12-31 23:00"),…
KatyB
  • 3,920
  • 7
  • 42
  • 72
-1
votes
1 answer

I cannot fit a GAM to my dataset, what is wrong with it?

I am trying to analyse Lobster egg development between the months of January and June by measuring the eyespot to gather the perkins eye index (PEI). I have a dataset with two variables, Month, ranging from January and June, and PEI, ranging from 1…
Laurie
  • 1
-1
votes
2 answers

Visualize Generalized Additive Model (GAM) in R

I want to achieve a GAM plot that looks like this Image from https://stats.stackexchange.com/questions/179947/statistical-differences-between-two-hourly-patterns/446048#446048 How can I accomplish this? Model is model = gam(y ~ s(t) + g, data = d)
nerd
  • 473
  • 5
  • 15
-1
votes
1 answer

is there an R function by which you I can extract GAM summary output as a table to be presented in a document?

I have run a GAM and obtained a summary output. I want to extract the output of summary into a table, so that I can use it in a document.
-1
votes
1 answer

Error in is.data.frame(data) : object 'data='' not found

I'm pretty new to r and struggling to write a function: I'm trying to make one that fits a GAM. I found an example for a linear model, that works perfectly fine. However, trying to use the same structure for a GAM throws me an error. Linear…
scriptgirl_3000
  • 161
  • 3
  • 16
1 2 3
45
46