This package is intended to provide some basic abstractions and default implementations of basic computational infrastructure for multivariate component-based modeling such as principal components analysis.
The main idea is to model multivariate decompositions as involving projections from an input data space to a lower dimensional component space. This idea is encapsulated by the projector class and the project function. Support for two-way mapping (row projection and column projection) is provided by the derived class bi-projector. Generic functions for common operations are included:
-
projectfor mapping from input space into (usually) reduced-dimensional output space -
partial_projectfor mapping a subset of input space into output space -
project_varsfor mapping new variables (“supplementary variables”) to output space -
reconstructfor reconstructing input data from its low-dimensional representation -
residualsfor extracting residuals of a fit withncomponents.
The package now also includes a mixed-model path for operator-valued ANOVA. With mixed_regress(), each named fixed-effect term in a repeated-measures design can be extracted as an effect_operator, then analyzed with the same core verbs:
-
effectfor named term extraction -
componentsandscoresfor interpretable effect axes -
reconstructfor effect contributions in original variable space -
perm_testfor omnibus and rank inference -
bootstrapfor subject-level stability
The broader calibration harness for this path lives at experimental/mixed_effect_operator_calibration.R, with batch outputs saved under experimental/results/ when you run the simulation grid locally.
Installation
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("bbuchsbaum/multivarious")Example
This is a basic example which shows you how to solve a common problem:
library(multivarious)
#>
#> Attaching package: 'multivarious'
#> The following objects are masked from 'package:stats':
#>
#> residuals, screeplot
#> The following objects are masked from 'package:base':
#>
#> transform, truncate
## basic example codeMixed effect operators
set.seed(1)
design <- expand.grid(
subject = factor(seq_len(6)),
level = factor(c("low", "mid", "high"), levels = c("low", "mid", "high")),
KEEP.OUT.ATTRS = FALSE
)
design$group <- factor(rep(c("A", "B"), each = 9))
level_num <- c(low = -1, mid = 0, high = 1)[as.character(design$level)]
group_num <- ifelse(design$group == "B", 1, 0)
subj_idx <- as.integer(design$subject)
b0 <- rnorm(6, sd = 0.5)
Y <- cbind(
b0[subj_idx] + level_num + rnorm(nrow(design), sd = 0.15),
group_num + rnorm(nrow(design), sd = 0.15),
level_num * group_num + rnorm(nrow(design), sd = 0.15),
rnorm(nrow(design), sd = 0.15)
)
fit <- mixed_regress(
Y,
design = design,
fixed = ~ group * level,
random = ~ 1 | subject,
basis = shared_pca(3),
preproc = pass()
)
E <- effect(fit, "group:level")
pt <- perm_test(E, nperm = 19, alpha = 0.10)
ncomp(E)
#> [1] 0
ncomp(pt)
#> [1] 0Albers theme
This package uses the albersdown theme. Vignettes are styled with vignettes/albers.css and a local vignettes/albers.js; the palette family is provided via params$family (default ‘red’). The pkgdown site uses template: { package: albersdown }.
Albers theme
This package uses the albersdown theme. Existing vignette theme hooks are replaced so albers.css and local albers.js render consistently on CRAN and GitHub Pages. The defaults are configured via params$family and params$preset (family = ‘red’, preset = ‘homage’). The pkgdown site uses template: { package: albersdown } together with generated pkgdown/extra.css and pkgdown/extra.js so the theme is linked and activated on site pages.