install.packages("earlywarnings")
library(devtools)
install_github("earlywarningtoolbox/earlywarnings-R/earlywarnings")
git clone git@github.com:earlywarningtoolbox/earlywarnings-R.git
./build.sh
library(earlywarnings)
## Loading required package: ggplot2
## Loading required package: moments
## Loading required package: tgp
## Loading required package: tseries
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
##
## earlywarnings Copyright (C) 2011-2022 Vasilis Dakos and Leo Lahti
## http://www.early-warning-signals.org
Potential analysis, used for instance in [Hirota et al. Science, 2011, 334, 232-235.]
# Create simulated example data
<- c(rnorm(1000, mean = 0), rnorm(1000, mean = -2),
X rnorm(1000, mean = 2))
<- seq(0,5,length=3000)
param
# Run potential analysis
<- movpotential_ews(X, param)
res
# Visualize
<- PlotPotential(res$res, title = '',
p xlab.text = '', ylab.text = '',
cutoff = 0.5, plot.contours = TRUE, binwidth = 0.2)
print(p)
This work can be freely used, modified and distributed under the Two-clause (Free)BSD license.
Kindly cite the work as ‘Vasilis Dakos and Leo Lahti (2014). earlywarnings R package. URL: https://github.com/earlywarningtoolbox/earlywarnings-R’.
citation("earlywarnings")
## Warning in person1(given = given[[i]], family = family[[i]], middle =
## middle[[i]], : It is recommended to use 'family' instead of 'last'.
## Warning in person1(given = given[[i]], family = family[[i]], middle =
## middle[[i]], : It is recommended to use 'family' instead of 'last'.
##
## To cite earlywarnings in publications use:
##
##
##
##
##
## To see these entries in BibTeX format, use 'print(<citation>,
## bibtex=TRUE)', 'toBibtex(.)', or set
## 'options(citation.bibtex.max=999)'.
This vignette was created with
sessionInfo()
## R version 4.2.0 (2022-04-22)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Mojave 10.14.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
##
## locale:
## [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] earlywarnings_1.1.29 tseries_0.10-51 tgp_2.4-18
## [4] moments_0.14.1 ggplot2_3.3.6
##
## loaded via a namespace (and not attached):
## [1] lattice_0.20-45 zoo_1.8-10 digest_0.6.29 lmtest_0.9-40
## [5] utf8_1.2.2 R6_2.5.1 evaluate_0.15 maptree_1.4-8
## [9] spam_2.8-0 highr_0.9 pillar_1.7.0 rlang_1.0.2
## [13] curl_4.3.2 rstudioapi_0.13 TTR_0.24.3 jquerylib_0.1.4
## [17] rpart_4.1.16 rmarkdown_2.16 labeling_0.4.2 stringr_1.4.0
## [21] munsell_0.5.0 compiler_4.2.0 xfun_0.31 pkgconfig_2.0.3
## [25] htmltools_0.5.3 tibble_3.1.7 gridExtra_2.3 quadprog_1.5-8
## [29] fansi_1.0.3 viridisLite_0.4.0 crayon_1.5.1 withr_2.5.0
## [33] grid_4.2.0 jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1
## [37] magrittr_2.0.3 scales_1.2.0 KernSmooth_2.23-20 quantmod_0.4.20
## [41] cli_3.3.0 stringi_1.7.6 cachem_1.0.6 som_0.3-5.1
## [45] farver_2.1.0 viridis_0.6.2 bslib_0.4.0 ellipsis_0.3.2
## [49] xts_0.12.1 vctrs_0.4.1 boot_1.3-28 nortest_1.0-4
## [53] tools_4.2.0 glue_1.6.2 maps_3.4.0 fields_13.3
## [57] fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3 cluster_2.1.3
## [61] isoband_0.2.5 Kendall_2.2.1 dotCall64_1.0-1 knitr_1.39
## [65] sass_0.4.2