26 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
0
answers
62
views
Gratia derivatives of a factor smooth
I fit a hierarchical generalized additive model with a sum to zero smooth interactions (bs="sz"). I would like to take the first derivative and plot the simultaneous confidence interval in ...
1
vote
1
answer
34
views
gratia::draw(): "'length.out' must be a non-negative number"
I'm trying to plot a factor-smooth term bs='fs' from my model, but I keep getting this error from gratia::draw(mod):
Error in seq.default(from = lower, to = upper, length.out = n) :
'length.out' must ...
1
vote
2
answers
119
views
Changing the title and labels of the plot provided by draw in the gratia package
I would like to change the title of the plot and the labels on the x and y axes without modifying the variable names in the dataframe.
I am using the gratia package.
library(patchwork)
library(gratia) ...
1
vote
1
answer
106
views
Adding a geom_sf to a long-lat plot with gratia package in R
Using the draw function from the gratia package with a model that contains a smooth s(longitude, latitude) will plot a long-lat plot and effect contours. That's very nice!
I want to add a country ...
0
votes
0
answers
124
views
Missing category in reference level in multinomial GAM with mgcv in R
Consider the multinomial GAM with mgcv in R
library(mgcv)
multinom = gam(list(sound ~ word + s(long, lat),
~ word + s(long, lat),
~ word + s(long, ...
0
votes
1
answer
411
views
Step failure (and iteration limit) in multinomial GAM with mgcv in R
I have a data set with 40 sites (long, lat) by 2 ages by 2 genders by 6 words and 6 dependent sound categories (coded 0 to 5) as simulated here:
sound <- sample(0:5, size=960, replace=T)
...
1
vote
1
answer
76
views
Cannot force legend to bottom in gratia::compare_smooths
I am using the wonderful gratia package to visualize multiple gam models from the mgcv package using the compare_smooths function. While I am able to create the gams properly and draw them, I cannot ...
2
votes
1
answer
312
views
How do I plot GAM model with log transformed response
I created a GAM model using mgcv. My response variable is log transformed. I would like to plot this model using gratia. However, I want to make sure the y-axis is exponentiated after I plot it using ...
2
votes
2
answers
290
views
How to add points to the diagram of GAM results displayed with the plot_smooths() function?
I cannot add points to the diagram of GAM results displayed with the plot_smooths() function of tidymv package.
I would like to add points to the diagram of GAM results displayed with the plot_smooths(...
1
vote
1
answer
7k
views
"Error in Ops.data.frame(guide_loc, panel_loc) : ‘==’ only defined for equally-sized data frames" when using draw() from gratia to draw GAM in r
I am trying to draw GAMs in R using the below code. This code always used to work, and I could draw the partial effect of my smoothed term, but randomly it no longer works, consistently triggering ...
0
votes
0
answers
259
views
Manually creating a rootogram to evaluate a GAM with a Tweedie distribution?
I have count data of a species which I am modelling using GAMs with negative binomial and Tweedie families.
I want to compare the models visually using rootograms.
This works fine for the negative ...
1
vote
1
answer
107
views
Variance calculation warning: longer object length is not a multiple
I'm getting this warning after checking the variance components of my model. I don't have NA's and the warning goes away when I remove this s(CYR.std, fSite, bs = "fs") term. Is it possibly ...
1
vote
2
answers
279
views
How to plot multiple GAMM smooths in one ggplot?
I'm hoping to plot my global effect s(CYR.std), along with my site deviations s(CYR.std, fSite, bs = "fs") term in ggplot. I can plot one at a time, but can't figure out how to include both ...
2
votes
1
answer
442
views
Modifying plots of the compare_smooths function in gratia package (R)
I am using the draw and compare_smooths functions in the gratia package in R to create plots visualizing smooths from two logistic GAMs. I would like to edit these plots to (1) include raw data; (2) ...
1
vote
1
answer
140
views
mgcv predict with bivariate te smooth : average over one covariate
Say I'm using mgcv in R to model a time trend with seasonality that changes over time, say te(year, month) ... Is it possible or even logical to generate a smooth estimate or fitted values for year ...