Skip to content

Commit

Permalink
Automated build.
Browse files Browse the repository at this point in the history
Files changed:
A	.Rbuildignore
A	.github/linters/.lintr
A	.setup/build/cTMed.pdf
A	.setup/build/cTMed_0.0.0.9000.tar.gz
M	.setup/cpp/cTMed-direct-vec.cpp
M	.setup/cpp/cTMed-direct.cpp
M	.setup/cpp/cTMed-indirect-vec.cpp
M	.setup/cpp/cTMed-indirect.cpp
M	.setup/cpp/cTMed-mc-med.cpp
M	.setup/cpp/cTMed-mc-phi-i.cpp
M	.setup/cpp/cTMed-mc-phi.cpp
M	.setup/cpp/cTMed-med-s.cpp
M	.setup/cpp/cTMed-med-vec.cpp
M	.setup/cpp/cTMed-med.cpp
A	.setup/latex/bib/quarto.bib
A	.setup/lint/.lintr
A	CITATION.cff
M	DESCRIPTION
A	LICENSE
A	LICENSE.md
A	NAMESPACE
A	R/RcppExports.R
M	R/cTMed-mc-beta-dot.R
A	R/nBootstrap-ci-format-dot.R
A	R/nBootstrap-pc-ci-dot.R
A	R/nBootstrap-pc-probs-dot.R
A	R/wald-ci-wald-dot.R
A	R/wald-probs-of-alpha-dot.R
A	README.md
A	man/DeltaMed.Rd
A	man/Direct.Rd
A	man/Indirect.Rd
A	man/MCMed.Rd
A	man/MCPhi.Rd
A	man/Med.Rd
A	man/PosteriorMed.Rd
A	man/PosteriorPhi.Rd
A	man/TestPhi.Rd
A	man/TestStable.Rd
A	man/Total.Rd
A	man/cTMed-package.Rd
A	man/confint.ctmeddelta.Rd
A	man/confint.ctmedmc.Rd
A	man/plot.ctmeddelta.Rd
A	man/plot.ctmedmc.Rd
A	man/plot.ctmedmed.Rd
A	man/print.ctmeddelta.Rd
A	man/print.ctmedeffect.Rd
A	man/print.ctmedmc.Rd
A	man/print.ctmedmcphi.Rd
A	man/print.ctmedmed.Rd
A	man/summary.ctmeddelta.Rd
A	man/summary.ctmedmc.Rd
A	man/summary.ctmedmed.Rd
M	project.Rproj
A	src/Makevars
A	src/Makevars.win
A	src/RcppExports.cpp
A	src/source.cpp
A	vignettes/vignettes.bib
  • Loading branch information
jeksterslab committed Apr 10, 2024
1 parent c126d3b commit 4e92d8a
Show file tree
Hide file tree
Showing 60 changed files with 8,471 additions and 18 deletions.
20 changes: 20 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.*\.Rcheck$
.*\.Rproj$
.*\.sif$
^CITATION\.cff$
^LICENSE\.md$
^Makefile$
^README\.Rmd$
^README\.md$
^\.Rproj\.user$
^\.devcontainer$
^\.git.*$
^\.library$
^\.setup$
^\.sim$
^detritus$
^index\.qmd$
^pkgdown$
^quarto$
^scripts$
^vignettes$
6 changes: 6 additions & 0 deletions .github/linters/.lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
linters: lintr::linters_with_defaults(lintr::object_name_linter(styles = c("CamelCase", "snake_case", "symbols")))
exclusions: list("R/RcppExports.R", "R/methods.R")
exclude: "# Exclude Linting"
exclude_start: "# Begin Exclude Linting"
exclude_end: "# End Exclude Linting"

Binary file added .setup/build/cTMed.pdf
Binary file not shown.
Binary file added .setup/build/cTMed_0.0.0.9000.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-direct-vec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.DirectVec)]]
double DirectVec(const arma::vec& phi_vec, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
double DirectVec(const arma::vec& phi_vec, const double& delta_t,
const int& from, const int& to, const arma::vec& med) {
int p = std::sqrt(phi_vec.n_elem);
arma::mat phi = arma::reshape(phi_vec, p, p);
arma::mat d = arma::eye(p, p);
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-direct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.Direct)]]
double Direct(const arma::mat& phi, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
double Direct(const arma::mat& phi, const double& delta_t, const int& from,
const int& to, const arma::vec& med) {
int p = phi.n_rows;
arma::mat d = arma::eye(p, p);
int m = med.n_elem;
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-indirect-vec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.IndirectVec)]]
double IndirectVec(const arma::vec& phi_vec, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
double IndirectVec(const arma::vec& phi_vec, const double& delta_t,
const int& from, const int& to, const arma::vec& med) {
int p = std::sqrt(phi_vec.n_elem);
arma::mat phi = arma::reshape(phi_vec, p, p);
// total effect
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-indirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.Indirect)]]
double Indirect(const arma::mat& phi, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
double Indirect(const arma::mat& phi, const double& delta_t, const int& from,
const int& to, const arma::vec& med) {
int p = phi.n_rows;
// total effect
arma::mat total = arma::expmat(delta_t * phi);
Expand Down
4 changes: 3 additions & 1 deletion .setup/cpp/cTMed-mc-med.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.MCMed)]]
arma::mat MCMed(const arma::mat& phi, const arma::mat& vcov_phi_vec_l, const double& delta_t, const int& from, const int& to, const arma::vec& med, const int& R, bool test_phi = true) {
arma::mat MCMed(const arma::mat& phi, const arma::mat& vcov_phi_vec_l,
const double& delta_t, const int& from, const int& to,
const arma::vec& med, const int& R, bool test_phi = true) {
arma::mat output(R, 4);
int p = phi.n_rows;
int q = p * p;
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-mc-phi-i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.MCPhiI)]]
arma::mat MCPhiI(const arma::mat& phi, const arma::mat& vcov_phi_vec_l, bool test_phi = true) {
arma::mat MCPhiI(const arma::mat& phi, const arma::mat& vcov_phi_vec_l,
bool test_phi = true) {
int p = phi.n_rows;
int q = p * p;
arma::mat phi_i = arma::mat(p, p);
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-mc-phi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.MCPhi)]]
Rcpp::List MCPhi(const arma::mat& phi, const arma::mat& vcov_phi_vec_l, const int& R, bool test_phi = true) {
Rcpp::List MCPhi(const arma::mat& phi, const arma::mat& vcov_phi_vec_l,
const int& R, bool test_phi = true) {
Rcpp::List output(R);
int p = phi.n_rows;
int q = p * p;
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-med-s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.Meds)]]
const arma::mat Meds(const arma::mat& phi, const arma::vec& delta_t, const int& from, const int& to, const arma::vec& med) {
const arma::mat Meds(const arma::mat& phi, const arma::vec& delta_t,
const int& from, const int& to, const arma::vec& med) {
int t = delta_t.n_rows;
arma::mat output = arma::mat(t, 4);
int p = phi.n_rows;
Expand Down
4 changes: 3 additions & 1 deletion .setup/cpp/cTMed-med-vec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.MedVec)]]
Rcpp::NumericVector MedVec(const arma::vec& phi_vec, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
Rcpp::NumericVector MedVec(const arma::vec& phi_vec, const double& delta_t,
const int& from, const int& to,
const arma::vec& med) {
Rcpp::NumericVector output(3);
int p = std::sqrt(phi_vec.n_elem);
arma::mat phi = arma::reshape(phi_vec, p, p);
Expand Down
3 changes: 2 additions & 1 deletion .setup/cpp/cTMed-med.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export(.Med)]]
Rcpp::NumericVector Med(const arma::mat& phi, const double& delta_t, const int& from, const int& to, const arma::vec& med) {
Rcpp::NumericVector Med(const arma::mat& phi, const double& delta_t,
const int& from, const int& to, const arma::vec& med) {
Rcpp::NumericVector output(4);
int p = phi.n_rows;
// total effect
Expand Down
11 changes: 11 additions & 0 deletions .setup/latex/bib/quarto.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@Article{Wright-1918,
author = {Sewall Wright},
date = {1918-07},
journaltitle = {Genetics},
title = {On the nature of size factors},
doi = {10.1093/genetics/3.4.367},
number = {4},
pages = {367--374},
volume = {3},
publisher = {Oxford University Press ({OUP})},
}
6 changes: 6 additions & 0 deletions .setup/lint/.lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
linters: lintr::linters_with_defaults(lintr::object_name_linter(styles = c("CamelCase", "snake_case", "symbols")))
exclusions: list("R/RcppExports.R", "R/methods.R")
exclude: "# Exclude Linting"
exclude_start: "# Begin Exclude Linting"
exclude_end: "# End Exclude Linting"

35 changes: 35 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v1.0.0
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------

cff-version: 1.2.0
message: 'To cite package "cTMed" in publications use:'
type: software
license: MIT
title: 'cTMed: Continuous Time Mediation'
version: 0.0.0.9000
abstract: Calculates standard errors and confidence intervals for the indirect effect
in continuous time mediation models.
authors:
- family-names: Pesigan
given-names: Ivan Jacob Agaloos
email: [email protected]
orcid: https://orcid.org/0000-0003-4818-8420
preferred-citation:
type: manual
title: 'cTMed: Continuous Time Mediation'
authors:
- family-names: Pesigan
given-names: Ivan Jacob Agaloos
email: [email protected]
orcid: https://orcid.org/0000-0003-4818-8420
year: '2024'
notes: R package version 0.0.0.9000
repository-code: https://github.com/jeksterslab/cTMed
url: https://jeksterslab.github.io/cTMed/
contact:
- family-names: Pesigan
given-names: Ivan Jacob Agaloos
email: [email protected]
orcid: https://orcid.org/0000-0003-4818-8420
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Suggests:
testthat,
simStateSpace,
expm
RoxygenNote: 7.3.1
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: Ivan Jacob Agaloos Pesigan
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 Ivan Jacob Agaloos Pesigan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by roxygen2: do not edit by hand

S3method(confint,ctmeddelta)
S3method(confint,ctmedmc)
S3method(plot,ctmeddelta)
S3method(plot,ctmedmc)
S3method(plot,ctmedmed)
S3method(print,ctmeddelta)
S3method(print,ctmedeffect)
S3method(print,ctmedmc)
S3method(print,ctmedmcphi)
S3method(print,ctmedmed)
S3method(summary,ctmeddelta)
S3method(summary,ctmedmc)
S3method(summary,ctmedmed)
export(DeltaMed)
export(Direct)
export(Indirect)
export(MCMed)
export(MCPhi)
export(Med)
export(PosteriorMed)
export(PosteriorPhi)
export(TestPhi)
export(TestStable)
export(Total)
importFrom(Rcpp,sourceCpp)
useDynLib(cTMed, .registration = TRUE)
133 changes: 133 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

.DirectVec <- function(phi_vec, delta_t, from, to, med) {
.Call(`_cTMed_DirectVec`, phi_vec, delta_t, from, to, med)
}

.Direct <- function(phi, delta_t, from, to, med) {
.Call(`_cTMed_Direct`, phi, delta_t, from, to, med)
}

.IndirectVec <- function(phi_vec, delta_t, from, to, med) {
.Call(`_cTMed_IndirectVec`, phi_vec, delta_t, from, to, med)
}

.Indirect <- function(phi, delta_t, from, to, med) {
.Call(`_cTMed_Indirect`, phi, delta_t, from, to, med)
}

.MCMed <- function(phi, vcov_phi_vec_l, delta_t, from, to, med, R, test_phi = TRUE) {
.Call(`_cTMed_MCMed`, phi, vcov_phi_vec_l, delta_t, from, to, med, R, test_phi)
}

.MCPhiI <- function(phi, vcov_phi_vec_l, test_phi = TRUE) {
.Call(`_cTMed_MCPhiI`, phi, vcov_phi_vec_l, test_phi)
}

.MCPhi <- function(phi, vcov_phi_vec_l, R, test_phi = TRUE) {
.Call(`_cTMed_MCPhi`, phi, vcov_phi_vec_l, R, test_phi)
}

.Meds <- function(phi, delta_t, from, to, med) {
.Call(`_cTMed_Meds`, phi, delta_t, from, to, med)
}

.MedVec <- function(phi_vec, delta_t, from, to, med) {
.Call(`_cTMed_MedVec`, phi_vec, delta_t, from, to, med)
}

.Med <- function(phi, delta_t, from, to, med) {
.Call(`_cTMed_Med`, phi, delta_t, from, to, med)
}

#' Test the Drift Matrix
#'
#' Both have to be true for the function to return `TRUE`.
#' - Test that the real part of all eigenvalues of \eqn{\boldsymbol{\Phi}}
#' is less than zero.
#' - Test that the diagonal values of \eqn{\boldsymbol{\Phi}}
#' are between 0 to negative inifinity.
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param phi Numeric matrix.
#' The drift matrix (\eqn{\boldsymbol{\Phi}}).
#'
#' @examples
#' phi <- matrix(
#' data = c(
#' -0.357, 0.771, -0.450,
#' 0.0, -0.511, 0.729,
#' 0, 0, -0.693
#' ),
#' nrow = 3
#' )
#' colnames(phi) <- rownames(phi) <- c("x", "m", "y")
#' TestPhi(phi = phi)
#' phi <- matrix(
#' data = c(
#' -6, 5.5, 0, 0,
#' 1.25, -2.5, 5.9, -7.3,
#' 0, 0, -6, 2.5,
#' 5, 0, 0, -6
#' ),
#' nrow = 4
#' )
#' colnames(phi) <- rownames(phi) <- paste0("y", 1:4)
#' TestPhi(phi = phi)
#'
#' @family Continuous Time Mediation Functions
#' @keywords cTMed test
#' @export
TestPhi <- function(phi) {
.Call(`_cTMed_TestPhi`, phi)
}

#' Test Stability
#'
#' The function computes the eigenvalues of the input matrix `x`.
#' It checks if the real part of all eigenvalues is negative.
#' If all eigenvalues have negative real parts,
#' the system is considered stable.
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param x Numeric matrix.
#'
#' @examples
#' x <- matrix(
#' data = c(
#' -0.357, 0.771, -0.450,
#' 0.0, -0.511, 0.729,
#' 0, 0, -0.693
#' ),
#' nrow = 3
#' )
#' TestStable(x)
#' x <- matrix(
#' data = c(
#' -6, 5.5, 0, 0,
#' 1.25, -2.5, 5.9, -7.3,
#' 0, 0, -6, 2.5,
#' 5, 0, 0, -6
#' ),
#' nrow = 4
#' )
#' TestStable(x)
#'
#' @family Continuous Time Mediation Functions
#' @keywords cTMed test
#' @export
TestStable <- function(x) {
.Call(`_cTMed_TestStable`, x)
}

.TotalVec <- function(phi_vec, delta_t) {
.Call(`_cTMed_TotalVec`, phi_vec, delta_t)
}

.Total <- function(phi, delta_t) {
.Call(`_cTMed_Total`, phi, delta_t)
}

Loading

0 comments on commit 4e92d8a

Please sign in to comment.