-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8820a1d
commit 38656fe
Showing
68 changed files
with
7,111 additions
and
22 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
* | ||
*/ | ||
!.gitignore | ||
!bib.bib |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ message: 'To cite package "cTMed" in publications use:' | |
type: software | ||
license: GPL-3.0-or-later | ||
title: 'cTMed: Continuous Time Mediation' | ||
version: 1.0.4.9000 | ||
version: 1.0.5 | ||
identifiers: | ||
- type: doi | ||
value: 10.32614/CRAN.package.cTMed | ||
|
@@ -31,7 +31,7 @@ preferred-citation: | |
email: [email protected] | ||
orcid: https://orcid.org/0000-0003-4818-8420 | ||
year: '2024' | ||
notes: R package version 1.0.4.9000 | ||
notes: R package version 1.0.5 | ||
repository: https://CRAN.R-project.org/package=cTMed | ||
repository-code: https://github.com/jeksterslab/cTMed | ||
url: https://jeksterslab.github.io/cTMed/ | ||
|
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
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,153 @@ | ||
.BootCentral <- function(phi, | ||
phi_hat, | ||
delta_t, | ||
total, | ||
ncores = NULL) { | ||
if (total) { | ||
Fun <- .TotalCentral | ||
} else { | ||
Fun <- .IndirectCentral | ||
} | ||
# nocov start | ||
par <- FALSE | ||
if (!is.null(ncores)) { | ||
ncores <- as.integer(ncores) | ||
R <- length(phi) | ||
if (ncores > R) { | ||
ncores <- R | ||
} | ||
if (ncores > 1) { | ||
par <- TRUE | ||
} | ||
} | ||
if (par) { | ||
os_type <- Sys.info()["sysname"] | ||
if (os_type == "Darwin") { | ||
fork <- TRUE | ||
} else if (os_type == "Linux") { | ||
fork <- TRUE | ||
} else { | ||
fork <- FALSE | ||
} | ||
if (fork) { | ||
output <- lapply( | ||
X = delta_t, | ||
FUN = function(i) { | ||
thetahatstar <- parallel::mclapply( | ||
X = phi, | ||
FUN = Fun, | ||
delta_t = i, | ||
mc.cores = ncores | ||
) | ||
thetahatstar <- do.call( | ||
what = "rbind", | ||
args = thetahatstar | ||
) | ||
colnames(thetahatstar) <- colnames(phi_hat) | ||
thetahatstar <- cbind( | ||
thetahatstar, | ||
interval = i | ||
) | ||
est <- c( | ||
Fun( | ||
phi = phi_hat, | ||
delta_t = i | ||
), | ||
i | ||
) | ||
names(est) <- c( | ||
colnames(phi_hat), | ||
"interval" | ||
) | ||
out <- list( | ||
delta_t = i, | ||
est = est, | ||
thetahatstar = thetahatstar | ||
) | ||
return(out) | ||
} | ||
) | ||
} else { | ||
cl <- parallel::makeCluster(ncores) | ||
on.exit( | ||
parallel::stopCluster(cl = cl) | ||
) | ||
output <- lapply( | ||
X = delta_t, | ||
FUN = function(i) { | ||
thetahatstar <- parallel::parLapply( | ||
cl = cl, | ||
X = phi, | ||
fun = Fun, | ||
delta_t = i | ||
) | ||
thetahatstar <- do.call( | ||
what = "rbind", | ||
args = thetahatstar | ||
) | ||
colnames(thetahatstar) <- colnames(phi_hat) | ||
thetahatstar <- cbind( | ||
thetahatstar, | ||
interval = i | ||
) | ||
est <- c( | ||
Fun( | ||
phi = phi_hat, | ||
delta_t = i | ||
), | ||
i | ||
) | ||
names(est) <- c( | ||
colnames(phi_hat), | ||
"interval" | ||
) | ||
out <- list( | ||
delta_t = i, | ||
est = est, | ||
thetahatstar = thetahatstar | ||
) | ||
return(out) | ||
} | ||
) | ||
} | ||
# nocov end | ||
} else { | ||
output <- lapply( | ||
X = delta_t, | ||
FUN = function(i) { | ||
thetahatstar <- lapply( | ||
X = phi, | ||
FUN = Fun, | ||
delta_t = i | ||
) | ||
thetahatstar <- do.call( | ||
what = "rbind", | ||
args = thetahatstar | ||
) | ||
colnames(thetahatstar) <- colnames(phi_hat) | ||
thetahatstar <- cbind( | ||
thetahatstar, | ||
interval = i | ||
) | ||
est <- c( | ||
Fun( | ||
phi = phi_hat, | ||
delta_t = i | ||
), | ||
i | ||
) | ||
names(est) <- c( | ||
colnames(phi_hat), | ||
"interval" | ||
) | ||
out <- list( | ||
delta_t = i, | ||
est = est, | ||
thetahatstar = thetahatstar | ||
) | ||
return(out) | ||
} | ||
) | ||
} | ||
return(output) | ||
} |
Oops, something went wrong.