Skip to content

Commit

Permalink
some little changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghui5801 committed Nov 27, 2024
1 parent 1946a90 commit 6f2c254
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 4 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R: c( person("Stavros", "Stavroglou", role = c("aut"),
comment = c(ORCID = "0009-0006-0095-0243")))
Maintainer: Hui Wang <[email protected]>
Description: The model proposes a robust methodology for detecting and reconstructing the hidden structure of dynamic complex systems through short-term forecasts and information embedded in reconstructed state spaces. The approach not only identifies critical components and causal interactions within these systems but also provides a practical tool for optimizing system performance and stability.
License: MIT + file LICENSE
License: GPL-3 | file LICENSE
Depends: R (>= 4.1.0)
Imports:
stats,
Expand All @@ -28,7 +28,8 @@ Suggests:
rmarkdown,
stringr,
ggplot2,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
lintr
Config/Needs/website:
tidyverse/tidytemplate
URL: https://github.com/skstavroglou/pattern_causality/
Expand Down
19 changes: 17 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
YEAR: 2024
COPYRIGHT HOLDER: Stavros Stavroglou
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2024 Stavros Stavroglou

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# patterncausality 0.1.3

* Added cross validation function for pattern causality
* Improved documentation and vignettes
* Fixed bugs in parameter optimization
* Added new plotting functions

# patterncausality 0.1.2

* Initial CRAN release
* Implemented core pattern causality algorithm
* Added basic visualization tools
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,14 @@ Monash Business School and is the author and maintainer of the
- Stavroglou, S. K., Ayyub, B. M., Kallinterakis, V., Pantelous, A. A.,
& Stanley, H. E. (2021). A novel causal risk‐based decision‐making
methodology: The case of coronavirus. _Risk Analysis, 41(5)_, 814-830.

## Test environments
* local R installation, R 4.1.0
* ubuntu 20.04 (on GitHub Actions), R 4.1.0
* win-builder (devel)

## R CMD check results
0 errors | 0 warnings | 0 notes

## Downstream dependencies
There are currently no downstream dependencies for this package
31 changes: 31 additions & 0 deletions inst/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing to patterncausality

Thank you for your interest in contributing to patterncausality!

## How to contribute

1. Fork the repository
2. Create a new branch for your feature
3. Make your changes
4. Add tests for new functionality
5. Run `devtools::check()`
6. Submit a pull request

## Code style

* Follow the tidyverse style guide
* Use roxygen2 for documentation
* Add examples to function documentation
* Keep functions focused and modular

## Testing

* Add tests for new functions
* Ensure all tests pass locally
* Maintain or improve code coverage

## Documentation

* Update vignettes if needed
* Keep README.md current
* Document all exported functions
4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(patterncausality)

test_check("patterncausality")
14 changes: 14 additions & 0 deletions tests/testthat/test-pcLightweight.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
test_that("pcLightweight works", {
data(climate_indices)
X <- climate_indices$AO
Y <- climate_indices$AAO

result <- pcLightweight(X, Y, E = 3, tau = 2,
metric = "euclidean", h = 1,
weighted = TRUE, tpb = FALSE)

expect_type(result, "list")
expect_named(result, c("total", "positive", "negative", "dark"))
expect_true(all(sapply(result, is.numeric)))
expect_true(all(sapply(result, function(x) x >= 0 && x <= 1)))
})

0 comments on commit 6f2c254

Please sign in to comment.