## Single update ##
# If we have first observed only the 148 cases from the
# Italian data we run the deviant function on these cases:
data("Italy")
EVI_output0<-deviant(new_cases=Italy$Cases[20:35], cum=FALSE, r_a=7, r=0.2, lag_max=30)
# EVI_output0<-deviant(new_cases=Italy$Cases[1:148], cum=FALSE, r_a=7, r=0.2, lag_max=30)
# When the number of cases for the next day is observed we want to obtain
# the estimates for this day without having to reanalyze the entire time series.
# This is done by using the deviant_update function:
EVI_output0<-deviant_update(new_cases=Italy$Cases[36],
EVI_input=EVI_output0,
cum=FALSE, r_a=7, r=0.2, lag_max=30)
# EVI_output0<-deviant_update(new_cases=Italy$Cases[149],
# EVI_input=EVI_output0,
# cum=FALSE, r_a=7, r=0.2, lag_max=30)
# The result of running the deviant_update function is to update the output of
# the deviant_function by adding an additional row with estimates for the new data.
# In this example the EVI_output file will now have 149 rows. If two additional
# days are analyzed two additional rows will be added and so on.
# Multiple update steps when new data come using either an EVI or cEVI updater ##
data("Italy")
EVI_output<-deviant(new_cases=Italy$Cases[1:20], cum=FALSE,
r_a=7, r=0.2, lag_max=30,method = "EVI")
EVI_output2<-deviant_update(new_cases = c(100,93,80,54,12),
EVI_input=EVI_output,method = "EVI")
#EVI_output2
# Same as above EVI_output2
#EVI_output2<-deviant_update(all_cases = c(Italy$Cases[1:20],100,93,80,54,12),
#EVI_input=EVI_output,method = "EVI")
#EVI_output2
#EVI_output3<-deviant_update(new_cases = c(2,2,10,1,0),EVI_input=EVI_output2,
#method = "cEVI")
#EVI_output3
# Even though EVI and cEVI can be used interchangeably, we suggest users to
# stick to the initial method.
Run the code above in your browser using DataLab