Skip to content

Commit

Permalink
Merge pull request #100 from bfast2/99-cut-freq-1
Browse files Browse the repository at this point in the history
Fix for bfastpp input with frequency=1
  • Loading branch information
GreatEmerald authored Oct 6, 2021
2 parents e5175da + f4a5b4c commit 67045ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changes in Version 1.7.0
o Added the option to run a structural change test before running bfastlite()
with two parameters: 'level' and 'type', equivalent to bfast() except that
anything equal to or below 0 in 'level' will skip the sctest.

o Fixed a bug where bfastpp() would throw an error when annual data is input.

Changes in Version 1.6.1

Expand Down
4 changes: 3 additions & 1 deletion R/bfastpp.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ bfastpp<- function(data, order = 3,
}

## data with trend and season factor
seasonfreq <- if (sbins > 1) sbins else frequency(y)*sbins

rval <- data.frame(
time = as.numeric(time(y)),
response = y,
trend = 1:NROW(y),
season = cut(cycle(y), if (sbins > 1) sbins else frequency(y)*sbins, ordered_result = TRUE)
season = if (seasonfreq > 1) cut(cycle(y), seasonfreq, ordered_result = TRUE) else factor("no seasonality")
)

## set up harmonic trend matrix as well
Expand Down

0 comments on commit 67045ad

Please sign in to comment.