Skip to content

Commit 266ee47

Browse files
committed
update docs
1 parent ec1ff43 commit 266ee47

27 files changed

+155
-178
lines changed

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
^misc$
1+
^dev$
22
^oldrel$
33

44
^.*\.Rproj$
@@ -14,3 +14,4 @@
1414
^NEWS\.md$
1515

1616
^vignettes/Aus.*xlsx
17+

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Suggests: covid19us, Ecdat, ggplot2, gridExtra, knitr, patchwork, randomcoloR, r
2424
Description: Nonparametric estimators and tests for time series analysis. The functions use bootstrap techniques and robust nonparametric difference-based estimators to test for the presence of possibly non-monotonic trends and for synchronicity of trends in multiple time series.
2525
RdMacros: Rdpack
2626
Roxygen: list(markdown = TRUE)
27-
RoxygenNote: 7.2.3
27+
RoxygenNote: 7.3.3
2828
Encoding: UTF-8
2929
VignetteBuilder: knitr, rmarkdown

NAMESPACE

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(toMlm,default)
4+
S3method(toMlm,varest)
5+
S3method(vcov,varest)
36
export(ARest)
47
export(AuePolyReg_test)
58
export(BICC)
@@ -14,21 +17,14 @@ export(causality_pred)
1417
export(causality_predVAR)
1518
export(ccf_boot)
1619
export(cumsumCPA_test)
17-
export(i.tails)
18-
export(mcusum.test)
1920
export(mcusum_test)
20-
export(notrend.test)
2121
export(notrend_test)
2222
export(purity)
23-
export(q.tails)
2423
export(r_crit)
25-
export(sync.cluster)
26-
export(sync.test)
2724
export(sync_cluster)
2825
export(sync_test)
2926
export(tails_i)
3027
export(tails_q)
31-
export(wavk.test)
3228
export(wavk_test)
3329
importFrom(Kendall,MannKendall)
3430
importFrom(Rdpack,reprompt)

R/AuePolyReg_test.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#' @references
3030
#' \insertAllCited{}
3131
#'
32-
#' @seealso \code{\link{mcusum.test}} change point test for regression
32+
#' @seealso \code{\link{mcusum_test}} change point test for regression
3333
#'
3434
#' @keywords changepoint ts
3535
#'

R/GombayCPA_test.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#' @references
3434
#' \insertAllCited{}
3535
#'
36-
#' @seealso \code{\link{mcusum.test}} change point test for regression and
36+
#' @seealso \code{\link{mcusum_test}} change point test for regression and
3737
#' \code{\link[Ecdat]{terrorism}} dataset used in the Example 2
3838
#'
3939
#' @keywords changepoint ts

R/cumsumCPA_test.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#'
2929
#' @keywords changepoint ts
3030
#'
31-
#' @seealso \code{\link{mcusum.test}} for change point test for regression
31+
#' @seealso \code{\link{mcusum_test}} for change point test for regression
3232
#'
3333
#' @author Palina Niamkova, Dorcas Ofori-Boateng, Yulia R. Gel
3434
#'

R/tails_i.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @references
2828
#' \insertAllCited{}
2929
#'
30-
#' @seealso \code{\link{q.tails}}
30+
#' @seealso \code{\link{tails_q}}
3131
#'
3232
#' @keywords ts
3333
#'

R/tails_q.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @references
2828
#' \insertAllCited{}
2929
#'
30-
#' @seealso \code{\link{i.tails}}
30+
#' @seealso \code{\link{tails_i}}
3131
#'
3232
#' @keywords ts
3333
#'

R/toMlm.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ toMlm <- function(x, ...){
2020
UseMethod("toMlm")
2121
}
2222

23-
toMlm.default <- function(x){
23+
#' @exportS3Method toMlm default
24+
toMlm.default <- function(x, ...){
2425
lm(x$model)
2526
}
2627

27-
toMlm.varest <- function(x){
28+
#' @exportS3Method toMlm varest
29+
toMlm.varest <- function(x, ...){
2830
ix <- 1:x$K
2931
X <- x$datamat
3032
int <- "-1" #automatic intercept is removed by default
@@ -75,6 +77,7 @@ bread.varest <- function(x, ...){
7577
sandwich::bread(toMlm.varest(x), ...)
7678
}
7779

80+
#' @exportS3Method vcov varest
7881
vcov.varest <- function(object, ...){
7982
stats::vcov(toMlm.varest(object), ...)
8083
}

dev/PACKAGE_ORGANIZATION_REVIEW.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Package Organization Review and Improvements
2+
3+
## Date: December 4, 2025
4+
5+
## Summary
6+
7+
This document summarizes the organizational review of the **funtimes** R package and the improvements implemented.
8+
9+
---
10+
11+
## Package Structure Overview
12+
13+
The funtimes package is a collection of functions for time series analysis with the following main categories:
14+
15+
1. **Trend Testing**: `notrend_test()`, `wavk_test()`, `sync_test()`, `WAVK()`, `HVK()`, `ARest()`
16+
2. **Changepoint Detection**: `mcusum_test()`, `cumsumCPA_test()`, `GombayCPA_test()`, `AuePolyReg_test()`
17+
3. **Time Series Clustering**: `sync_cluster()`, `CSlideCluster()`, `CWindowCluster()`, `BICC()`, `DR()`
18+
4. **Granger Causality**: `causality_pred()`, `causality_predVAR()`, `ccf_boot()`
19+
5. **Distribution Comparison**: `tails_i()`, `tails_q()`
20+
6. **Estimation**: `beales()`, `r_crit()`
21+
7. **Utilities**: `purity()`
22+
23+
---
24+
25+
## Issues Identified and Resolved
26+
27+
### 1. ✅ Undocumented Internal Helper Functions
28+
29+
**Issue**: Three files contained internal helper functions without proper documentation headers:
30+
- `fun_cusum.R` - CUSUM-related helpers
31+
- `fun_trust.R` - TRUST algorithm helpers
32+
- `fun_causality.R` - Causality testing helpers
33+
34+
**Resolution**: Added comprehensive internal documentation headers to all three files, including:
35+
- Purpose and context
36+
- List of functions contained
37+
- References to relevant papers
38+
- `@keywords internal` and `@noRd` tags
39+
40+
### 2. ✅ Undocumented Modified VAR Functions
41+
42+
**Issue**: Three files (`VAR.R`, `VARselect.R`, `toMlm.R`) are modified copies from the `vars` package, but the modifications were not well-documented.
43+
44+
**Resolution**: Enhanced documentation headers explaining:
45+
- Origin (vars package by Bernhard Pfaff)
46+
- Why modifications exist (unmerged pull request from 2021)
47+
- Key modifications (lag.restrict parameter, restricted VAR support)
48+
- Link to original pull request
49+
50+
### 3. ✅ Misc Directory Organization
51+
52+
**Issue**: The `misc/` directory contained a mix of experimental, archived, and old code without documentation.
53+
54+
**Resolution**: Created `misc/README.md` documenting:
55+
- **TopoCBN.R**: Archived function removed in v8.2 due to TDA dependency
56+
- **causality_predVAR_v0.R**: Old version kept for reference
57+
- **CRAD files**: Removed (experimental approach abandoned)
58+
59+
---
60+
61+
## Recommendations for Future Improvements
62+
63+
### High Priority
64+
65+
1. **Remove Defunct Functions** (noted in README "Future work")
66+
- The defunct function files (`i.tails.R`, `q.tails.R`, `mcusum.test.R`, `notrend.test.R`, `sync.test.R`, `sync.cluster.R`, `wavk.test.R`) only contain `.Defunct()` calls
67+
- Consider removing these entirely in next major version
68+
- Current approach is correct for graceful deprecation cycle
69+
70+
2. **Complete causality_pred() Documentation** (noted in README "Future work")
71+
- Add detailed description of statistics computed (MSEt, MSEcor, OOSF, EN)
72+
- Reference Clark & McCracken papers more explicitly in documentation
73+
74+
3. **✅ CRAD Implementation Decision** (RESOLVED)
75+
- CRAD files have been removed (experimental approach abandoned)
76+
- No Python dependencies remain in the package
77+
78+
### Medium Priority
79+
80+
4. **Consider Creating Internal Package Documentation**
81+
- Add a vignette or article on package internals for developers
82+
- Document the relationship between helper functions and exported functions
83+
- Explain the modified VAR implementation strategy
84+
85+
5. **File Naming Consistency**
86+
- Most functions use underscores (e.g., `wavk_test.R`)
87+
- Helper files use different conventions (`fun_*.R`)
88+
- Consider prefixing internal files more consistently (e.g., `internal_cusum.R`)
89+
90+
6. **Code Organization by Category**
91+
- Consider organizing R files into subdirectories by function category:
92+
- `R/trend/` - trend testing functions
93+
- `R/changepoint/` - changepoint detection
94+
- `R/clustering/` - clustering methods
95+
- `R/causality/` - causality testing
96+
- `R/internal/` - helper functions
97+
- However, R package structure typically keeps all `.R` files in `R/` directory, so this may not be necessary
98+
99+
### Low Priority
100+
101+
7. **Old Release Archives**
102+
- `oldrel/` directory contains package tarballs from v1.0 to v7.0
103+
- These can be accessed from CRAN archives
104+
- Consider removing to reduce repository size
105+
106+
8. **Add CITATION File**
107+
- Package has extensive references but no `inst/CITATION` file
108+
- Would help users cite the package properly
109+
110+
9. **Update Copyright/License Information**
111+
- Document that VAR-related functions are derived from `vars` package
112+
- Ensure GPL compatibility is maintained
113+
114+
---
115+
116+
## Package Strengths
117+
118+
1. **Excellent Documentation**: Most exported functions have comprehensive roxygen2 documentation with examples
119+
2. **Good Deprecation Practice**: Proper use of deprecated → defunct lifecycle
120+
3. **Well-Maintained**: Active development with clear version history in README
121+
4. **Comprehensive Vignettes**: Three informative vignettes for major use cases
122+
5. **Proper Citations**: Good use of Rdpack for inserting references
123+
124+
---
125+
126+
## Conclusion
127+
128+
The funtimes package is generally well-organized for a collection of diverse time series analysis functions. The improvements implemented today enhance the internal documentation and make the codebase more maintainable. The remaining recommendations are mostly cleanup tasks that can be addressed in future releases as the package continues to evolve.

0 commit comments

Comments
 (0)