library(Rbeast)
data(covid19)
if (FALSE) {
newcases = covid19$newcases
# This time series has a periodical variation of 7 days. 7 days can't be precisely
# represented in the unit of year bcz some years has 365 days and others has 366.
# So, here we use the date number as the time unit (i.e., the numeber of days lapsed
# since 1970-01-01).
datenum = as.numeric(covid19$date)
o = beast(newcases, start=min(datenum), deltat=1, freq=7)
o$time = as.Date(o$time, origin='1970-01-01') # Convert from integers to Date.
plot(o)
# Apply BEAST to the square root-transformed time series
o = beast(sqrt(newcases), start=min(datenum), deltat=1, freq=7)
o$time = as.Date(o$time, origin='1970-01-01') # Convert from integers to Date.
plot(o)
}
Run the code above in your browser using DataLab