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
0 answers

GLM and GAM modelling in RStudio

I have a question in GAM and GLM modelling in rstudio. Looking at results, each first factor stays in intercept, how do I stop that, so I can see all factor effects? Thanks Dave
0
votes
1 answer

R: GAM with multiple negative binomial thetas

I fit a Generalized Additive Model in the Negative Binomial family using gam from the mgcv package. I have a data frame containing my dependent variable Y, an independent variable X, other independent variables Oth and a factor Fac. I would like to…
yannick
  • 397
  • 3
  • 19
0
votes
1 answer

Running GAM function from mgcv package with R 3.2.2

I have recently run into a problem running a GAM model from a previously working code. I believe it is related to an updated R-Version and an updated Version of the mgcv package. It would be great to know if anyone has the same problem or has a…
mb_eco
  • 11
  • 1
  • 3
0
votes
1 answer

Handling numeric variables with special (non-physical) value in GAM model in R

I'm building a GAM model using mgcv and I have a feature like the following: value: -1000 0 1 2 3 4 5 6 7 8 count: 42943 978 1069 402 145 43 7 1 1 1 This feature has a special value…
xiaoxiao87
  • 783
  • 1
  • 8
  • 20
0
votes
1 answer

Extracting model reliability from multiple GAMs applied across a dataframe

I have been able to apply a General Additive Model iteratively across a dataframe, so where sp_a is the response variable... sp_a <- rnorm (100, mean = 3, sd = 0.9) var_env_1 <- rnorm (100, mean = 1, sd = 0.3) var_env_2 <- rnorm (100, mean = 5, sd…
James White
  • 705
  • 2
  • 7
  • 20
0
votes
1 answer

Visualizing GAM models in R

Does anyone know how to visualize the smooth component of gam models in R very well? I would really like to visualize something like the output of the function visreg. This code below illustrates my…
justin1.618
  • 691
  • 5
  • 15
0
votes
0 answers

R software: error when using cozigam() function

I am modelling the potential distribution of a species using COZIGAM package. I have the response variable ("pb", which tells where the species is present) and the predictor variables (e.g. altitude, temperature, precipitation, etc). When I run this…
0
votes
1 answer

How to change plot region colour in a vis.gam plot in R?

I have this dataset: sample <- structure(list(A = c(1415.6, 1345.3, 1321.7, 1234.5, 1567.8, 1476.6, 1610.1, 1422.6, 1209.1, 1249.3, 1377.5, 1525.7, 1683.7, 1500.1, 1565.3, 1737.4, 1321, 1477.8, 1642, 1608.1, 1427.8, 1608.2, 1404.4, 1688.3,…
user3624251
  • 185
  • 1
  • 8
0
votes
0 answers

Detection Probability Confidence Intervals from GAM

I'm trying to get the confidence intervals for the detection functions created using GAM's. I've gotten as far as creating the GAM with factors and variables model = gam(Capture>0~s(Distance)+s(Amplitude)+DetectorNumber, …
K.J. Palmer
  • 145
  • 3
  • 9
0
votes
1 answer

Error in gam function of smoothing spline regression

I'm trying to run a smoothing spline regression using gam for y as a function of a and b, variables in the dataset. But when I run the following code, I get the following error. > autogam_axb <- gam(data$y~s(data$a,data$b)) Error in eval(expr,…
shannimcg
  • 71
  • 1
  • 10
0
votes
1 answer

Unable to extract logLik from gamm model in R

Probably a stupid question but after hours of searching for an answer I still have not found a solution. I have run a gamm model and the model seems to work fine. I now want to use the calculate the AIC for the model using the log likelihood…
0
votes
0 answers

Unknown GAM error in program R

I'm conducting GAM modeling using a poisson error distribution with cubic regression splines, using count data of common ravens. I keep getting an odd error that I've never seen before in addition to some warnings. Here's my…
MjayL
  • 1
0
votes
0 answers

Multiple Regression using R is predicting negative Forecast

I have issue while predicting the forecast using Multiple Regression-GAM in R. Objective is to predict the forecast of a dependent variable using various independent variables and dummy variables and I have around more than 2 years data which i am…
Bharat
  • 1
  • 1
0
votes
1 answer

How to interpolate and `predict` using mgcv::gam?

I've begun by mastering how to use splines to interpolate 1-dimentional function. model = spline(bdp[,4]~bdp[,1]) I could then use predict(model, c(0)) to predict function value in point 0. Then I've searched the Internet to find something to…
jjaskulowski
  • 2,524
  • 3
  • 26
  • 36
0
votes
1 answer

R how to extract values from plot

I have a data.frame(x) and I am doing a GAM analysis. x = data[, c("asthma3", "TargetGroup2012", "age3", "SmokingGroup_Kai", "bmi3", "PA_Score")] x = na.omit(x) x = data.frame(scale(x)) g =…
Donbeo
  • 17,067
  • 37
  • 114
  • 188