ices-eg / wg_WGEEL

Joint EIFAAC/ICES/GFCM Working Group on Eels
http://ices.dk/community/groups/Pages/WGEEL.aspx
5 stars 12 forks source link

YS time series AGM with ordered factor #279

Open LBeaulaton opened 1 year ago

LBeaulaton commented 1 year ago

We analyse time series to see any differece in trends between countries. The formula is: value ~ s(year, by=country)

However is we order the country variable it does not give the same results :

check NO

The explanation is given here in the 'by' section. With thus conclude that NO has no effect while it is just because we order the factor.

Changing the formula with value ~ s(year) + s(year, by=country) allow to assess an effect for NO but does not give the exact same answer : image

cedricbriandgithub commented 1 year ago

Whaouh I didn't know, seems that using ordered. You are using ordered for graphical reasons ?

Same page says : Note that when using factor by variables, centering constraints are applied to the smooths, which usually
means that the by variable should be included as a parametric term, as well.

I would follow this advice and try :

value ~ country + s(year, by=country)
LBeaulaton commented 1 year ago

Yes that was for graphical reasons. I can find a workaround (reorderng after GAM). We already center the data. I can add the parametric term, but that do not change many things.

cedricbriandgithub commented 1 year ago

While writing this, I had little hope it would do any good.

LBeaulaton commented 1 year ago

I propose to let this issue open to be aware of that change next year

elfunesto commented 1 year ago

The weird thing is that NL(at least) also changes depending on whether you use an ordered or an unordered factor while, according to the manual, it should not?

LBeaulaton commented 1 year ago

I propose to let this issue open to be aware of that change next year