Timeline for Is it possible to make this GAM even less smooth to generate a better fit?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 2, 2019 at 16:27 | comment | added | Gavin Simpson |
I made a boo boo in my previous comment; s(group, bs = ‘fs’) should have been s(group, bs = ‘re’) , the "fs" basis comes up in the "lots of other options" things I referred to, and which we use a lot in the HGAM paper I linked to.
|
|
Jul 30, 2019 at 10:06 | comment | added | Marcel | @ Gavin Simpson Thanks a lot Gavin. I will study this. | |
Jul 29, 2019 at 9:15 | comment | added | Gavin Simpson |
@Marcel no; for each row in the data set you have a variable that records to which group each observation belongs. Say this group variable is called group , you would add + group for fixed group intercepts, + s(group, bs = ‘fs’) for random intercepts, or lots of other options if you separate smooths for the groups. This is a bit like HGAM, see: 10.7717/peerj.6876
|
|
Jul 27, 2019 at 15:06 | comment | added | Marcel | @ Gavin Thanks. Do you mean by adding a column in my dataset with the number of each group? I don't see anything specific regarding grouping in the helpfiles if I look with ?gam in R. | |
Jul 26, 2019 at 8:01 | comment | added | Gavin Simpson |
@Marcel You would need to tell gam() about the grouping so the effect gets modelled.
|
|
Jul 25, 2019 at 11:36 | comment | added | Marcel | @ Gavin Simpson Hi Gavin, I did the complete course which was very interesting. If I do understand correctly the bias-variance optimization is done internal by the penalty within the GAM. Although my data is grouped. For that reason I have to seperate my data normally by groups during CV so that a group can not be in train- an testset simultaniously. Can this be a problem if I use the GAM since I have no influence on this separation during the GAM optimization? | |
Jul 3, 2019 at 18:32 | vote | accept | Marcel | ||
Jul 3, 2019 at 18:32 | comment | added | Marcel | @ Gavin Simpson interesting there is a course! I will go through the course in the coming days. If I still have the question regarding cross validation after the course I let you know. Thanks! | |
Jul 3, 2019 at 15:42 | comment | added | Gavin Simpson |
Basically, all you need is for k to be large enough to contain the true function or an approximation to it, plus a little bit. The penalty will take care of the rest.
|
|
Jul 3, 2019 at 15:42 | comment | added | Gavin Simpson |
No, don't do that. I would actually spend an hour or more learning about how penalised regression spline models in GAMs like this work. A colleague has produced this free course on GAMs which is good (FD: it's based on course materials I contributed too). The basic ide is you use gam.check() to see if k was large enough, if not, double (say) k and refit. If the EDF of the estimated smooth doesn't change much and the test for k' is OK-ish (it is a heuristic) then you had large enough k .
|
|
Jul 3, 2019 at 13:10 | comment | added | Marcel |
@ Gavin Simpson this is exactly what I was looking for. The large differences between the GAM and the Pivot for x1 between 0 and 10 have been dissapeared with your settings. Moreover, with te or t2 and k c(10,10) the AUC improves to 0.8099. With k c(20,20) the AUC improves further to 0.8101. The s + ti -setting has an identical AUC of 0.8101. So now I can conclude that the method is flexible enough to fit my data. Would it be a logical step for me to add two loops around the code above with 20 x 20 combinations for k = c(a, b) and cross validate the model to find the optimal a and b?
|
|
Jul 2, 2019 at 22:16 | comment | added | user2165379 | Thanks a lot for your extensive answer. I will try to implement this. | |
Jul 2, 2019 at 22:08 | history | answered | Gavin Simpson | CC BY-SA 4.0 |