-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from x0range/development
Fixed README and DESCRIPTION and documentation
- Loading branch information
Showing
6 changed files
with
124 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
Package: finity | ||
Type: Package | ||
Title: Test for finiteness of moments in a distribution | ||
Version: 0.1 | ||
Date: 2019-11-14 | ||
Title: Test for Finiteness of Moments in a Distribution | ||
Version: 0.1.4 | ||
Date: 2020-04-17 | ||
Authors@R: c(person("Torsten", "Heinrich", role = c("aut", "cre"), | ||
email = "torsten.heinrich@oxfordmartin.ox.ac.uk"), | ||
email = "torsten.heinrich@posteo.net"), | ||
person("Julian", "Winkler", role = c("aut"), | ||
email = "[email protected]")) | ||
Author: Torsten Heinrich <[email protected]>, | ||
Julian Winkler <[email protected]> | ||
Maintainer: Torsten Heinrich <[email protected]> | ||
Description: Tests whether a given moment of the distribution of a given | ||
sample is finite or not. | ||
Author: Torsten Heinrich [aut, cre], Julian Winkler [aut] | ||
Maintainer: Torsten Heinrich <[email protected]> | ||
Description: The purpose of this package is to tests whether a given | ||
moment of the distribution of a given sample is finite or not. For | ||
heavy-tailed distributions with tail exponent b, only moments of | ||
order smaller than b are finite. Tail exponent and heavy- | ||
tailedness are notoriously difficult to ascertain. But the | ||
finiteness of moments (including fractional moments) can be tested | ||
directly. This package does that following the test suggested by | ||
Trapani (2016) <doi:10.1016/j.jeconom.2015.08.006>. | ||
License: GPL (>= 2) | ||
Imports: Rcpp (>= 1.0.3) | ||
Imports: Rcpp (>= 1.0.3), stabledist (>= 0.7) | ||
LinkingTo: Rcpp, RcppArmadillo, BH | ||
RoxygenNote: 7.0.0 | ||
Encoding: UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.example_finite_moment_test <- function() { | ||
|
||
# Generate sample | ||
rvs <- stabledist::rstable(100000, 1.9, 0.5, 1, 0, pm = 0) | ||
|
||
# Perform test | ||
result <- finite_moment_test(rvs, 2) | ||
|
||
# Print results | ||
message(paste("Test statistic:", result[1], "p-value:", result[2], "\n\n")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,59 @@ | ||
# finity | ||
|
||
Package for testing whether a given moment of the distribution of a given sample is finite or not. | ||
|
||
|
||
# Details | ||
|
||
For heavy-tailed distributions with tail exponent a, only moments of order < a are finite. The tail | ||
index and heavy- tailedness are is notoriously difficult to ascertain. But the finiteness of moments | ||
(including fractional moments) can be tested directly. This package does that following the test | ||
suggested by Trapani (2016). | ||
|
||
|
||
# Installing from CRAN | ||
|
||
```install.packages(finity)``` | ||
|
||
|
||
# Usage: How to perform the finite moment test | ||
|
||
``` | ||
library(stabledist) | ||
library(finity) | ||
# Generate test data | ||
rvs <- rstable(10000000, 1.9, 0.5, 1, 0, pm = 0) | ||
# Perform the test | ||
result <- finite_moment_test(rvs, 2) | ||
``` | ||
|
||
|
||
# Building and installing the package from github | ||
|
||
``` | ||
Rscript -e 'setwd("finity");Rcpp::compileAttributes()' | ||
R CMD build finity | ||
R CMD INSTALL finity_0.1.1.tar.gz | ||
``` | ||
In the install command, ```finity_0.1.1.tar.gz``` should be replaced with the correct filename of the archive (in particular with the correct version number). | ||
|
||
```Rcpp::compileAttributes()``` can also be run from the R interpreter. The shell commands can alternatively be run from the R interpreter as ```system("R CMD build finity")``` etc. | ||
|
||
|
||
# Building the pdf manual from the github package | ||
|
||
``` | ||
Rscript -e 'setwd("finity");roxygen2::roxygenize();roxygen2::roxygenize()' | ||
R CMD Rd2pdf finity | ||
``` | ||
|
||
Alternatively, ```roxygen2::roxygenize()``` can be executed twice from the R interpreter before building the pdf with ```R CMD Rd2pdf finity```. | ||
|
||
It is important to execute ```roxygenize()``` twice since the help files for the individual functions are only created the second time. | ||
|
||
|
||
# Building as an R/CRAN package | ||
|
||
Remove the ```examples``` directory and follow the steps for building (and installing) and building the pdf manual. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters