Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different but equivalent inputs for deltat and period yield contradicting results #42

Open
sarah-hlsn opened this issue Dec 17, 2024 · 0 comments

Comments

@sarah-hlsn
Copy link

The python docstrings for the beast() function mention the following example for monthly data:

## Monthly google search popularity of the keyword 'beach'
beach, time = rb.load_example('googletrend')   

# If not specfified, season='harmonic' is assumed by default, with a seasonal 
# component fitted.
o = rb.beast(beach, start=[2004,1], deltat=1/12)  # deltat = 1/12 yr =1 month
rb.print(o)
rb.plot(o)
rb.plot(o,ncpStat='median')
 
# delta  = 1/12: for dates, the default unit is year, so delta=1/12yr=1 month;       
# period = 1.0 means 1 year
o=rb.beast(beach, start='2004-1-15', deltat=1/12, period=1.0)  
 
# period='12 month': use a string to explicitly specify the unit      
o=rb.beast(beach, start=[2004,1], deltat=1/12,      period='12 month')
o=rb.beast(beach, start=[2004,1], deltat='1 month', period='365 days')

Here it is implied that the different (but equivalent) options given for the deltat and period arguments may influence how dates are handled, but not the actual analysis (?). However, when trying out the different options, they result in a different number of trend changepoints in the plot.

Specificallyo=rb.beast(beach, start='2004-1-15', deltat=1/12, period=1.0) results in 6 trend changepoints, while all other options result in 5 (I counted the black vertical lines in the plot).
I ran into the same issue with my own monthly data, i.e. getting varying numbers or date of occurence for trend changepoints when using deltat and period in ways that should be equivalent. I have also consulted the more detailed R documentation, but am still unsure what is causing this issue.

Is this a potential bug or am I misunderstanding how the function works? Can you recommend which options for deltat and period I should use when working with monthly averages (12 datapoints per year, over 22 years in total) which contain a seasonal component (in my case I am working with EVI data)?

Many thanks in advance!

@sarah-hlsn sarah-hlsn changed the title Different but equivalent inputs for deltat and periode yield contradicting results Different but equivalent inputs for deltat and period yield contradicting results Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant