methodsPLS | R Documentation |
Function returnPLSModel
fits a PLS regression (using
plsr
) individually to each freely varying parameter of a model, unlike
a true multivariate PLS regression. A secondary step than limits the number
of components to those that explain some minimum cumulative percentage
of variance (see argument variance.cutoff
). For ABC, this seems to result in much
better results, without one parameter dominating the combined variance.
returnPLSModel(
trueFreeValuesMatrix,
summaryValuesMatrix,
validation = "CV",
scale = TRUE,
variance.cutoff = 95,
verbose = TRUE,
segments = min(10, nrow(summaryValuesMatrix) - 1),
...
)
PLSTransform(summaryValuesMatrix, pls.model)
trueFreeValuesMatrix |
Matrix of true free values from simulations. |
summaryValuesMatrix |
Matrix of summary statistics from simulations. |
validation |
Character argument controlling what
validation procedure is used by |
scale |
This argument is passed to |
variance.cutoff |
Minimum threshold percentage of variance explained for the number of components included in the final PLS model fit. This value is a percentage and must be between 0 and 100. Default is 95 percent. |
verbose |
If |
segments |
Number of segments of data used for crossvalidaton
by |
... |
Additional arguments, passed to |
pls.model |
Output from |
Function PLSTransform
uses results from a Partial Least Squares (PLS)
model fit with returnPLSModel
to transform summary values.
Function returnPLSModel
returns a PLS model, and
function PLSTransform
returns transformed summary statistics.
Brian O'Meara and Barb Banbury
Function returnPLSModel
effectively wraps function plsr
from package pls
(see documentation at mvr
).
set.seed(1)
simPhyExample <- rcoal(20)
simPhyExample$edge.length <- simPhyExample$edge.length * 20
# example simulation
nSimulations <- 6
simDataParallel <- parallelSimulateWithPriors(
nrepSim = nSimulations,
multicore = FALSE,
coreLimit = 1,
phy = simPhyExample,
intrinsicFn = brownianIntrinsic,
extrinsicFn = nullExtrinsic,
startingPriorsFns = "normal",
startingPriorsValues = list(
c(mean(simCharExample[, 1]),
sd(simCharExample[, 1]))),
intrinsicPriorsFns = c("exponential"),
intrinsicPriorsValues = list(10),
extrinsicPriorsFns = c("fixed"),
extrinsicPriorsValues = list(0),
generation.time = 10000,
checkpointFile = NULL,
checkpointFreq = 24,
verbose = FALSE,
freevector = NULL,
taxonDF = NULL
)
nParFree <- sum(attr(simDataParallel, "freevector"))
# separate the simulation results:
# 'true' generating parameter values from the summary values
trueFreeValuesMat <- simDataParallel[, 1:nParFree]
summaryValuesMat <- simDataParallel[, -1:-nParFree]
PLSmodel <- returnPLSModel(
trueFreeValuesMatrix = trueFreeValuesMat,
summaryValuesMatrix = summaryValuesMat,
validation = "CV",
scale = TRUE,
variance.cutoff = 95 ,
segments = nSimulations
)
PLSmodel
PLSTransform(
summaryValuesMatrix = summaryValuesMat,
pls.model = PLSmodel
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.