Skip to content

Commit

Permalink
Automated build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeksterslab committed May 10, 2024
1 parent 8eaf4cc commit f702a10
Show file tree
Hide file tree
Showing 18 changed files with 4,096 additions and 21 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
^\.git.*$
^\.library$
^\.setup$
^\.sif$
^\.sim$
^detritus$
^index\.qmd$
Expand Down
Binary file modified .setup/build/cTMed.pdf
Binary file not shown.
Binary file modified .setup/build/cTMed_0.9.1.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/pdf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
*/
!*.pdf
!.gitignore
!bib.bib
3,976 changes: 3,976 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.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ S3method(print,ctmedmed)
S3method(summary,ctmeddelta)
S3method(summary,ctmedmc)
S3method(summary,ctmedmed)
S3method(summary,ctmedposteriorphi)
export(DeltaBeta)
export(DeltaIndirectCentral)
export(DeltaMed)
Expand Down
57 changes: 57 additions & 0 deletions R/cTMed-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,63 @@ summary.ctmedmed <- function(object,
}
}

#' Summary Method for Object of Class `ctmedposteriorphi`
#'
#' @author Ivan Jacob Agaloos Pesigan
#' @param object an object of class `ctmedposteriorphi`.
#' @param ... further arguments.
#' @return Returns a list of the posterior means
#' (in matrix form) and covariance matrix.
#'
#' @examples
#' set.seed(42)
#' 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")
#' mc <- MCPhi(
#' phi = phi,
#' vcov_phi_vec = 0.1 * diag(9),
#' R = 100L # use a large value for R in actual research
#' )$output
#' summary(mc)
#'
#' @keywords methods
#' @export
summary.ctmedposteriorphi <- function(object,
...) {
varnames <- colnames(object[[1]])
p <- dim(object[[1]])[1]
x <- do.call(
what = "rbind",
args = lapply(
X = object,
FUN = function(x) {
dim(x) <- NULL
return(x)
}
)
)
phi_vec <- colMeans(x)
phi <- matrix(
data = phi_vec,
nrow = p
)
colnames(phi) <- rownames(phi) <- varnames
vcov_phi_vec <- stats::var(x)
return(
list(
phi = phi,
vcov_phi_vec = vcov_phi_vec
)
)
}

#' Summary Method for an Object of Class `ctmeddelta`
#'
#' @author Ivan Jacob Agaloos Pesigan
Expand Down
21 changes: 12 additions & 9 deletions R/cTMed-posterior-phi.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ PosteriorPhi <- function(object) {
)
varnames <- object$ctstanmodelbase$latentNames
posterior <- ctsem::ctExtract(object)$pop_DRIFT
return(
lapply(
X = seq_len(dim(posterior)[1]),
FUN = function(i) {
phi <- posterior[i, , ]
colnames(phi) <- rownames(phi) <- varnames
return(phi)
}
)
out <- lapply(
X = seq_len(dim(posterior)[1]),
FUN = function(i) {
phi <- posterior[i, , ]
colnames(phi) <- rownames(phi) <- varnames
return(phi)
}
)
class(out) <- c(
"ctmedposteriorphi",
class(out)
)
return(out)
}
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
2024-05-03
2024-05-10

<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- badges: start -->
Expand Down
43 changes: 43 additions & 0 deletions man/summary.ctmedposteriorphi.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f702a10

Please sign in to comment.