Skip to content

Commit

Permalink
Automated build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeksterslab committed Jan 14, 2025
1 parent e377cef commit 724c6c8
Show file tree
Hide file tree
Showing 45 changed files with 6,011 additions and 376 deletions.
Binary file modified .setup/build/cTMed.pdf
Binary file not shown.
Binary file modified .setup/build/cTMed_1.0.4.9000.tar.gz
Binary file not shown.
11 changes: 0 additions & 11 deletions .setup/latex/bib/quarto.bib

This file was deleted.

5 changes: 5 additions & 0 deletions .setup/latex/cTMed-zzz-tests-internal.Rtex
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@

\maketitle

%% begin.rcode
% #| include = FALSE
% Sys.setenv(NOT_CRAN = "true")
%% end.rcode

\section*{Tests}

%% begin.rcode
Expand Down
5 changes: 5 additions & 0 deletions .setup/latex/pdf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
*/
!*.pdf
!.gitignore
!bib.bib
5,635 changes: 5,635 additions & 0 deletions .setup/latex/pdf/bib.bib

Large diffs are not rendered by default.

Binary file added .setup/latex/pdf/cTMed-001-description.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-999-session.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-zzz-references.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-zzz-tests-benchmark.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-zzz-tests-external.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-zzz-tests-internal.pdf
Binary file not shown.
Binary file added .setup/latex/pdf/cTMed-zzz-tests-staging.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion .setup/vignettes/fit-ct-var-dynr.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ knitr::opts_chunk$set(
```{r}
#| echo = FALSE
set.seed(42)
n <- 50
n <- 5
time <- 100
delta_t <- 0.10
k <- p <- 3
Expand Down
2 changes: 1 addition & 1 deletion .setup/vignettes/fit-ct-var-mx.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ knitr::opts_chunk$set(
```{r}
#| echo = FALSE
set.seed(42)
n <- 50
n <- 5
time <- 100
delta_t <- 0.10
k <- p <- 3
Expand Down
6 changes: 3 additions & 3 deletions .setup/vignettes/med-boot.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The `cTMed` package provides a bootstrap approach, in addition to the delta and
```{r}
#| include = FALSE
set.seed(42)
n <- 50
n <- 5
time <- 100
delta_t <- 0.10
k <- p <- 3
Expand Down Expand Up @@ -357,13 +357,13 @@ theta_l <- t(chol(theta))
```

```{r}
R <- 1000L
R <- 5L # use at least 1000 in actual research
path <- getwd()
prefix <- "ou"
```

The estimated parameters are then passed as arguments to the `PBSSMOUFixed` function from the `simStateSpace` package, which generates a parametric bootstrap sampling distribution of the parameter estimates. The argument `R` specifies the number of bootstrap replications.
The generated data and model estimates are be stored in `path` using the specified `prefix` for the file names.
The generated data and model estimates are stored in `path` using the specified `prefix` for the file names.
The `ncores = parallel::detectCores()` argument instructs the function to use all available CPU cores in the system.

> **_NOTE:_** Fitting the CT-VAR model multiple times is computationally intensive.
Expand Down
2 changes: 1 addition & 1 deletion .setup/vignettes/med-std.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mc <- MCMedStd(
from = "x",
to = "y",
med = "m",
R = 20000L,
R = 1000L,
ncores = parallel::detectCores() # use multiple cores
)
plot(mc)
Expand Down
2 changes: 1 addition & 1 deletion .setup/vignettes/med.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mc <- MCMed(
from = "x",
to = "y",
med = "m",
R = 20000L,
R = 1000L,
ncores = parallel::detectCores() # use multiple cores
)
plot(mc)
Expand Down
4 changes: 2 additions & 2 deletions R/cTMed-plot-central-ci-dot.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
if (object$args$method == "boot") {
ylab <- "Estimate"
if (type == "pc") {
method <- "Percentile Bootstrap Method"
method <- "PC Bootstrap Method"
}
if (type == "bc") {
method <- "Bias-Corrected Bootstrap Method"
method <- "BC Bootstrap Method"
}
}
if (object$args$method %in% c("mc", "posterior")) {
Expand Down
4 changes: 2 additions & 2 deletions R/cTMed-plot-med-ci-dot.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@
if (object$args$method == "boot") {
ylab <- "Estimate"
if (type == "pc") {
method <- "Percentile Bootstrap Method"
method <- "PC Bootstrap Method"
}
if (type == "bc") {
method <- "Bias-Corrected Bootstrap Method"
method <- "BC Bootstrap Method"
}
}
if (object$args$method %in% c("mc", "posterior")) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cTMed
================
Ivan Jacob Agaloos Pesigan
2025-01-13
2025-01-14

<!-- README.md is generated from README.Rmd. Please edit that file -->

Expand Down
Binary file modified vignettes/fig-vignettes-med-boot-boot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-boot-boot-std-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-mc-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-mc-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-mc-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-std-mc-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-std-mc-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig-vignettes-med-std-mc-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
273 changes: 137 additions & 136 deletions vignettes/fit-ct-var-dynr.Rmd

Large diffs are not rendered by default.

252 changes: 126 additions & 126 deletions vignettes/fit-ct-var-mx.Rmd

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions vignettes/med-boot.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Total, Direct, and Indirect Effects in Continuous-Time Mediation Model (Bootstrap)"
author: Ivan Jacob Agaloos Pesigan
date: "2025-01-13"
date: "2025-01-14"
bibliography: "vignettes.bib"
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl
nocite: |
Expand Down Expand Up @@ -45,40 +45,40 @@ In this example, we will use the fitted model from [Fit the Continuous-Time Vect
``` r
summary(fit)
#> Coefficients:
#> Estimate Std. Error t value ci.lower ci.upper Pr(>|t|)
#> phi_1_1 -0.293807 0.082574 -3.558 -0.455648 -0.131966 0.0002 ***
#> phi_2_1 0.824396 0.056914 14.485 0.712846 0.935946 <2e-16 ***
#> phi_3_1 -0.454316 0.057647 -7.881 -0.567303 -0.341329 <2e-16 ***
#> phi_1_2 -0.071916 0.068787 -1.045 -0.206735 0.062904 0.1479
#> phi_2_2 -0.568999 0.048532 -11.724 -0.664119 -0.473878 <2e-16 ***
#> phi_3_2 0.707647 0.048636 14.550 0.612322 0.802972 <2e-16 ***
#> phi_1_3 0.025791 0.062589 0.412 -0.096882 0.148463 0.3402
#> phi_2_3 0.082668 0.043529 1.899 -0.002647 0.167983 0.0288 *
#> phi_3_3 -0.687502 0.044092 -15.593 -0.773920 -0.601084 <2e-16 ***
#> sigma_1_1 0.235806 0.022759 10.361 0.191198 0.280413 <2e-16 ***
#> sigma_2_1 0.018668 0.010045 1.858 -0.001020 0.038356 0.0316 *
#> sigma_3_1 -0.064687 0.010768 -6.007 -0.085793 -0.043582 <2e-16 ***
#> sigma_2_2 0.077088 0.009447 8.160 0.058572 0.095603 <2e-16 ***
#> sigma_3_2 0.008278 0.006655 1.244 -0.004765 0.021321 0.1068
#> sigma_3_3 0.080654 0.010196 7.910 0.060670 0.100639 <2e-16 ***
#> theta_1_1 0.201033 0.005107 39.363 0.191023 0.211043 <2e-16 ***
#> theta_2_2 0.191640 0.004373 43.823 0.183069 0.200211 <2e-16 ***
#> theta_3_3 0.197449 0.004521 43.677 0.188588 0.206309 <2e-16 ***
#> mu0_1_1 -0.068547 0.142210 -0.482 -0.347273 0.210180 0.3149
#> mu0_2_1 0.084573 0.176685 0.479 -0.261722 0.430869 0.3161
#> mu0_3_1 0.115721 0.141485 0.818 -0.161585 0.393026 0.2067
#> sigma0_1_1 0.942679 0.205369 4.590 0.540164 1.345195 <2e-16 ***
#> sigma0_2_1 0.161788 0.179880 0.899 -0.190769 0.514346 0.1842
#> sigma0_3_1 0.103257 0.143856 0.718 -0.178696 0.385209 0.2365
#> sigma0_2_2 1.489721 0.311204 4.787 0.879772 2.099670 <2e-16 ***
#> sigma0_3_2 -0.100464 0.178078 -0.564 -0.449491 0.248563 0.2863
#> sigma0_3_3 0.946144 0.204219 4.633 0.545882 1.346406 <2e-16 ***
#> Estimate Std. Error t value ci.lower ci.upper Pr(>|t|)
#> phi_1_1 -0.4698862 0.3734948 -1.258 -1.2019225 0.2621501 0.1045
#> phi_2_1 0.4809285 0.1781928 2.699 0.1316771 0.8301800 0.0036 **
#> phi_3_1 -0.2711150 0.2083709 -1.301 -0.6795145 0.1372845 0.0969 .
#> phi_1_2 -0.1084163 0.2321649 -0.467 -0.5634512 0.3466185 0.3204
#> phi_2_2 -0.2331007 0.1105811 -2.108 -0.4498357 -0.0163658 0.0178 *
#> phi_3_2 0.5796100 0.1363571 4.251 0.3123549 0.8468651 <2e-16 ***
#> phi_1_3 0.1213907 0.1565825 0.775 -0.1855054 0.4282868 0.2193
#> phi_2_3 -0.0744270 0.0735117 -1.012 -0.2185074 0.0696533 0.1559
#> phi_3_3 -0.5738682 0.0916326 -6.263 -0.7534648 -0.3942715 <2e-16 ***
#> sigma_1_1 0.3007396 0.1122916 2.678 0.0806521 0.5208271 0.0038 **
#> sigma_2_1 0.0498648 0.0401853 1.241 -0.0288969 0.1286265 0.1076
#> sigma_3_1 -0.0741897 0.0428654 -1.731 -0.1582043 0.0098249 0.0421 *
#> sigma_2_2 0.0457407 0.0234338 1.952 -0.0001887 0.0916700 0.0258 *
#> sigma_3_2 0.0122009 0.0206733 0.590 -0.0283181 0.0527198 0.2777
#> sigma_3_3 0.0881988 0.0337203 2.616 0.0221082 0.1542894 0.0046 **
#> theta_1_1 0.1991190 0.0178903 11.130 0.1640546 0.2341833 <2e-16 ***
#> theta_2_2 0.2112520 0.0148880 14.189 0.1820720 0.2404319 <2e-16 ***
#> theta_3_3 0.1913294 0.0140468 13.621 0.1637981 0.2188606 <2e-16 ***
#> mu0_1_1 -0.2189028 0.1678919 -1.304 -0.5479650 0.1101593 0.0965 .
#> mu0_2_1 0.5735116 0.2813058 2.039 0.0221625 1.1248608 0.0210 *
#> mu0_3_1 0.6406938 0.7675896 0.835 -0.8637542 2.1451418 0.2022
#> sigma0_1_1 0.0663477 0.0789889 0.840 -0.0884677 0.2211631 0.2007
#> sigma0_2_1 0.0480017 0.1080453 0.444 -0.1637632 0.2597665 0.3285
#> sigma0_3_1 -0.3808122 0.3502062 -1.087 -1.0672038 0.3055793 0.1387
#> sigma0_2_2 0.3573753 0.2484766 1.438 -0.1296299 0.8443804 0.0755 .
#> sigma0_3_2 0.1946208 0.5038433 0.386 -0.7928940 1.1821355 0.3497
#> sigma0_3_3 2.8986422 1.8778449 1.544 -0.7818662 6.5791505 0.0617 .
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> -2 log-likelihood value at convergence = 21626.57
#> AIC = 21680.57
#> BIC = 21856.53
#> -2 log-likelihood value at convergence = 2176.87
#> AIC = 2230.87
#> BIC = 2344.67
```

We need to extract the estimated parameters from the fitted object, which will be used to generate bootstrap samples.
Expand All @@ -87,7 +87,7 @@ We need to extract the estimated parameters from the fitted object, which will b
``` r
est <- coef(fit)
n
#> [1] 50
#> [1] 5
time
#> [1] 100
delta_t
Expand All @@ -109,8 +109,8 @@ mu0 <- est[
)
]
mu0
#> mu0_1_1 mu0_2_1 mu0_3_1
#> -0.06854665 0.08457349 0.11572075
#> mu0_1_1 mu0_2_1 mu0_3_1
#> -0.2189028 0.5735116 0.6406938
sigma0 <- matrix(
data = est[
c(
Expand All @@ -129,10 +129,10 @@ sigma0 <- matrix(
ncol = 3
)
sigma0
#> [,1] [,2] [,3]
#> [1,] 0.9426793 0.1617881 0.1032567
#> [2,] 0.1617881 1.4897213 -0.1004635
#> [3,] 0.1032567 -0.1004635 0.9461439
#> [,1] [,2] [,3]
#> [1,] 0.06634768 0.04800168 -0.3808122
#> [2,] 0.04800168 0.35737526 0.1946208
#> [3,] -0.38081224 0.19462078 2.8986422
sigma0_l <- t(chol(sigma0))
phi <- matrix(
data = est[
Expand All @@ -152,10 +152,10 @@ phi <- matrix(
ncol = 3
)
phi
#> [,1] [,2] [,3]
#> [1,] -0.2938068 -0.07191554 0.02579061
#> [2,] 0.8243958 -0.56899879 0.08266777
#> [3,] -0.4543161 0.70764697 -0.68750180
#> [,1] [,2] [,3]
#> [1,] -0.4698862 -0.1084163 0.12139067
#> [2,] 0.4809285 -0.2331007 -0.07442704
#> [3,] -0.2711150 0.5796100 -0.57386817
sigma <- matrix(
data = est[
c(
Expand All @@ -168,10 +168,10 @@ sigma <- matrix(
ncol = 3
)
sigma
#> [,1] [,2] [,3]
#> [1,] 0.23580555 0.018668186 -0.064687273
#> [2,] 0.01866819 0.077087752 0.008277734
#> [3,] -0.06468727 0.008277734 0.080654489
#> [,1] [,2] [,3]
#> [1,] 0.30073959 0.04986477 -0.07418968
#> [2,] 0.04986477 0.04574067 0.01220087
#> [3,] -0.07418968 0.01220087 0.08819880
sigma_l <- t(chol(sigma))
theta <- diag(3)
diag(theta) <- est[
Expand All @@ -182,22 +182,22 @@ diag(theta) <- est[
)
]
theta
#> [,1] [,2] [,3]
#> [1,] 0.2010327 0.0000000 0.0000000
#> [2,] 0.0000000 0.1916402 0.0000000
#> [3,] 0.0000000 0.0000000 0.1974485
#> [,1] [,2] [,3]
#> [1,] 0.199119 0.000000 0.0000000
#> [2,] 0.000000 0.211252 0.0000000
#> [3,] 0.000000 0.000000 0.1913294
theta_l <- t(chol(theta))
```


``` r
R <- 1000L
R <- 5L # use at least 1000 in actual research
path <- getwd()
prefix <- "ou"
```

The estimated parameters are then passed as arguments to the `PBSSMOUFixed` function from the `simStateSpace` package, which generates a parametric bootstrap sampling distribution of the parameter estimates. The argument `R` specifies the number of bootstrap replications.
The generated data and model estimates are be stored in `path` using the specified `prefix` for the file names.
The generated data and model estimates are stored in `path` using the specified `prefix` for the file names.
The `ncores = parallel::detectCores()` argument instructs the function to use all available CPU cores in the system.

> **_NOTE:_** Fitting the CT-VAR model multiple times is computationally intensive.
Expand Down
4 changes: 2 additions & 2 deletions vignettes/med-std.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Standardized Total, Direct, and Indirect Effects in Continuous-Time Mediation Model"
author: Ivan Jacob Agaloos Pesigan
date: "2025-01-13"
date: "2025-01-14"
bibliography: "vignettes.bib"
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl
nocite: |
Expand Down Expand Up @@ -133,7 +133,7 @@ mc <- MCMedStd(
from = "x",
to = "y",
med = "m",
R = 20000L,
R = 1000L,
ncores = parallel::detectCores() # use multiple cores
)
plot(mc)
Expand Down
4 changes: 2 additions & 2 deletions vignettes/med.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Total, Direct, and Indirect Effects in Continuous-Time Mediation Model"
author: Ivan Jacob Agaloos Pesigan
date: "2025-01-13"
date: "2025-01-14"
bibliography: "vignettes.bib"
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl
nocite: |
Expand Down Expand Up @@ -91,7 +91,7 @@ mc <- MCMed(
from = "x",
to = "y",
med = "m",
R = 20000L,
R = 1000L,
ncores = parallel::detectCores() # use multiple cores
)
plot(mc)
Expand Down
Loading

0 comments on commit 724c6c8

Please sign in to comment.