Skip to content

Commit

Permalink
fixing typo and AICc calculation bug (issue 7)
Browse files Browse the repository at this point in the history
  • Loading branch information
timginker committed Jan 26, 2025
1 parent 5360eb9 commit 49aada6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions R/boiwsa.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param x Input time series as a numeric vector
#' @param dates a vector of class "Date", containing the data dates
#' @param r Defines the rate of decay of the weights. Should be between zero and one. By default is set to 0.8.
#' @param auto.ao.seacrh Boolean. Search for additive outliers
#' @param auto.ao.search Boolean. Search for additive outliers
#' @param out.threshold t-stat threshold in outlier search. By default is 3.8
#' @param ao.list Vector with user specified additive outliers in a date format
#' @param my.k_l Numeric vector defining the number of yearly and monthly trigonometric variables. If NULL, is found automatically using the information criteria
Expand All @@ -36,7 +36,7 @@
boiwsa=function(x,
dates,
r=0.8,
auto.ao.seacrh=TRUE,
auto.ao.search=TRUE,
out.threshold=3.8,
ao.list=NULL,
my.k_l=NULL,
Expand Down Expand Up @@ -122,7 +122,7 @@ boiwsa=function(x,


aic0[i,j]=stats::AIC(m)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)+1)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)-1)
bic0[i,j]=stats::BIC(m)

}
Expand Down Expand Up @@ -405,7 +405,7 @@ boiwsa=function(x,

# looking for additive outliers

if(auto.ao.seacrh){
if(auto.ao.search){

auto.ao=find_outliers(y=y,dates=dates,H = H,my.AO.list = ao.list)

Expand Down
2 changes: 1 addition & 1 deletion R/find_opt.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ find_opt=function(x,dates,H=NULL,AO=NULL,method="additive",l.max=24,k.max=42,by=


aic0[i,j]=stats::AIC(m)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)+1)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)-1)
bic0[i,j]=stats::BIC(m)

}
Expand Down
2 changes: 1 addition & 1 deletion R/find_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ find_outliers=function(x,dates,out.tolerance=3.8,my.AO.list=NULL,H=NULL,my.k_l=N


aic0[i,j]=stats::AIC(m)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)+1)
aicc0[i,j]=stats::AIC(m)+2*length(m$coefficients)*(length(m$coefficients)+1)/(length(m$residuals)-length(m$coefficients)-1)
bic0[i,j]=stats::BIC(m)

}
Expand Down
4 changes: 2 additions & 2 deletions man/boiwsa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 49aada6

Please sign in to comment.