| path_effects | R Documentation |
Decomposes effects between blocks in a multiblock system into total effects, unique effects, common contributions, and additional effects. Supports both SO-PLS (Sequential Orthogonalised PLS) and ordinary least squares (OLS) approaches with cross-validation or fitted values.
path_effects(
relations,
blocks,
validation,
segments,
SO = TRUE,
fits = FALSE,
boot = 0,
ncomp = NULL,
transitive_closure = FALSE,
...
)
relations |
A matrix defining the path structure. Rows specify relationships
between blocks, with 2 columns: |
blocks |
A multiblock data frame or list of named matrices containing the block data. |
validation |
Validation method passed to |
segments |
Number of segments for cross-validation. Default is 5. |
SO |
Logical. If |
fits |
Logical. If |
boot |
Number of bootstrap samples for computing standard errors. Default is 0 (no bootstrapping). |
ncomp |
Optional component settings per predictor block. Supply either:
|
transitive_closure |
Logical. If |
... |
Additional arguments passed to underlying fitting functions. |
An object of class path_effects, which is a matrix with the following
components for each path:
Tot: Total effect
Un: Unique effect
Co: Common contribution
Ad: Additional effect
Attributes include:
scaled: Scaled contribution matrix
individual: Individual-level contributions
boot: Bootstrap replicates (if boot > 0)
print.path_effects(), plot.path_effects()
# Analysis of the mobile dataset
data(mobile)
# Define path structure (A->B, A->E, A->G, B->C, B->D, B->E, C->D, D->E,
# D->E, E->F, E->G, F->G)
paths <- matrix(c(1,2, 1,5, 1,7, 2,3, 2,4, 2,5, 3,4, 3,5, # Add 0,2, for A->C
4,5, 5,6, 5,7, 6,7),
ncol=2, byrow=TRUE)
# Compute path effects with cross-validation using SO-PLS
pem <- path_effects(paths, mobile, validation="CV", segments=5,
segment.type="consecutive")
# Print results
print(pem)
# Plot all results
plot(pem)
# Print and plot single path
print(pem, "A","G")
plot(pem, from = "A", to = "G")
# Print and plot results per variable
print(pem, individual = TRUE)
plot(pem, individual = TRUE)
# Analysis of the NIR-Raman-PUFA data (emulsions)
data(emulsions)
# Standardise response
emulsions$PUFA <- scale(emulsions$PUFA)
# Define path structure (NIR->Raman, NIR->PUFA, Raman->PUFA)
paths_NRP <- matrix(c(1,2,1,3,2,3), ncol = 2, byrow = TRUE)
## Not run: # Too time consuming
# Compute path effects with cross-validation using SO-PLS
pem_NRP <- path_effects(paths_NRP, emulsions, validation="CV",
segments = 5, segment.type="consecutive",
ncomp=c(16,15))
# Print results
print(pem_NRP)
# Plot all results
plot(pem_NRP)
## End(Not run)
# Reversed order of NIR and Raman (uncomment to run)
# paths_RNP <- matrix(c(2,1,2,3,1,3), ncol = 2, byrow = TRUE)
# pem_RNP <- path_effects(paths_RNP, emulsions, validation="CV",
# segments = 5, segment.type="consecutive", ncomp=c(16,15))
# print(pem_RNP)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.