Package: PCMBase 1.2.14

PCMBase: Simulation and Likelihood Calculation of Phylogenetic Comparative Models

Phylogenetic comparative methods represent models of continuous trait data associated with the tips of a phylogenetic tree. Examples of such models are Gaussian continuous time branching stochastic processes such as Brownian motion (BM) and Ornstein-Uhlenbeck (OU) processes, which regard the data at the tips of the tree as an observed (final) state of a Markov process starting from an initial state at the root and evolving along the branches of the tree. The PCMBase R package provides a general framework for manipulating such models. This framework consists of an application programming interface for specifying data and model parameters, and efficient algorithms for simulating trait evolution under a model and calculating the likelihood of model parameters for an assumed model and trait data. The package implements a growing collection of models, which currently includes BM, OU, BM/OU with jumps, two-speed OU as well as mixed Gaussian models, in which different types of the above models can be associated with different branches of the tree. The PCMBase package is limited to trait-simulation and likelihood calculation of (mixed) Gaussian phylogenetic models. The PCMFit package provides functionality for inference of these models to tree and trait data. The package web-site <https://venelin.github.io/PCMBase/> provides access to the documentation and other resources.

Authors:Venelin Mitov [aut, cre, cph], Krzysztof Bartoszek [ctb], Georgios Asimomitis [ctb], Tanja Stadler [ths]

PCMBase_1.2.14.tar.gz
PCMBase_1.2.14.zip(r-4.5)PCMBase_1.2.14.zip(r-4.4)PCMBase_1.2.14.zip(r-4.3)
PCMBase_1.2.14.tgz(r-4.4-any)PCMBase_1.2.14.tgz(r-4.3-any)
PCMBase_1.2.14.tar.gz(r-4.5-noble)PCMBase_1.2.14.tar.gz(r-4.4-noble)
PCMBase_1.2.14.tgz(r-4.4-emscripten)PCMBase_1.2.14.tgz(r-4.3-emscripten)
PCMBase.pdf |PCMBase.html
PCMBase/json (API)
NEWS

# Install 'PCMBase' in R:
install.packages('PCMBase', repos = c('https://venelin.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/venelin/pcmbase/issues

Datasets:

On CRAN:

7.56 score 6 stars 3 packages 85 scripts 387 downloads 160 exports 36 dependencies

Last updated 6 months agofrom:d3ba644f22. Checks:OK: 5 NOTE: 2. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 29 2024
R-4.5-winNOTEOct 29 2024
R-4.5-linuxNOTEOct 29 2024
R-4.4-winOKOct 29 2024
R-4.4-macOKOct 29 2024
R-4.3-winOKOct 29 2024
R-4.3-macOKOct 29 2024

Exports:Args_MixedGaussian_MGPMDefaultModelTypesArgs_MixedGaussian_MGPMScalarOUTypeArgs_MixedGaussian_MGPMSurfaceOUTypeas.MixedGaussianFalsePositiveRateFormatTableAsLatexis.AllEqualis.CholeskyFactoris.Diagonalis.Fixedis.GaussianPCMis.Globalis.Identityis.Localis.LowerTriangularis.LowerTriangularWithDiagonalis.MatrixParameteris.MixedGaussianis.NonNegativeis.Omittedis.Onesis.PCMis.PCMTreeis.ScalarDiagonalis.ScalarParameteris.Schuris.SemiPositiveDefiniteis.Symmetricis.Transformableis.Transformedis.UpperTriangularis.UpperTriangularWithDiagonalis.VectorParameteris.WithCustomVecParamsis.WithNonNegativeDiagonalis.ZerosMatchListMembersMGPMDefaultModelTypesMGPMScalarOUTypeMGPMSurfaceOUTypeMixedGaussianMixedGaussianTemplatePCMPCMAbCdEfPCMAddToListAttributePCMApplyTransformationPCMBaseIsADevReleasePCMColorPalettePCMCombineListAttributePCMCondPCMCondVOUPCMCreateLikelihoodPCMDefaultModelTypesPCMDefaultObjectPCMDescribePCMDescribeParametersPCMExtractDimensionsPCMExtractRegimesPCMFindMethodPCMFixParameterPCMGenerateModelTypesPCMGenerateParameterizationsPCMGetAttributePCMGetVecParamsRegimesAndModelsPCMInfoPCMLikPCMLikDmvNormPCMLikTracePCMListDefaultParameterizationsPCMListMembersPCMListParameterizationsPCMLmrPCMMapModelTypesToRegimesPCMMeanPCMMeanAtTimePCMModelsPCMModelTypesPCMNumRegimesPCMNumTraitsPCMOptionsPCMParamBindRegimeParamsPCMParamCountPCMParamGetShortVectorPCMParamLoadOrStorePCMParamLocateInShortVectorPCMParamLowerLimitPCMParamRandomVecParamsPCMParamSetByNamePCMParamUpperLimitPCMParentClassesPCMParseErrorMessagePCMPlotGaussianDensityGrid2DPCMPlotGaussianSample2DPCMPlotMathPCMPlotTraitData2DPCMPresentCoordinatesPCMRegimesPCMSetAttributePCMSimPCMSpecifyPCMTablePCMTableParameterizationsPCMTrajectoryPCMTreePCMTreeBackbonePartitionPCMTreeDropCladePCMTreeDtNodesPCMTreeEdgeTimesPCMTreeEvalNestedEDxOnTreePCMTreeExtractCladePCMTreeGetBranchLengthPCMTreeGetDaughtersPCMTreeGetLabelsPCMTreeGetNodeLabelsPCMTreeGetParentPCMTreeGetPartitionPCMTreeGetPartNamesPCMTreeGetPartRegimesPCMTreeGetPartsForNodesPCMTreeGetRegimesForEdgesPCMTreeGetRegimesForNodesPCMTreeGetRootLabelPCMTreeGetTipLabelsPCMTreeGetTipsInPartPCMTreeGetTipsInRegimePCMTreeInsertSingletonsPCMTreeInsertSingletonsAtEpochPCMTreeInsertTipsOrSingletonsPCMTreeJumpsPCMTreeListAllPartitionsPCMTreeListCladePartitionsPCMTreeListDescendantsPCMTreeListRootPathsPCMTreeLocateEpochOnBranchesPCMTreeLocateMidpointsOnBranchesPCMTreeMatchLabelsPCMTreeMatrixNodesInSamePartPCMTreeMatrixNodesInSameRegimePCMTreeNearestNodesToEpochPCMTreeNodeTimesPCMTreeNumNodesPCMTreeNumPartsPCMTreeNumTipsPCMTreePlotPCMTreePostorderPCMTreePreorderPCMTreeSetLabelsPCMTreeSetPartitionPCMTreeSetPartRegimesPCMTreeSetRegimesForEdgesPCMTreeSplitAtNodePCMTreeTableAncestorsPCMTreeToStringPCMTreeVCVPCMUnfixParameterPCMVarPCMVarAtTimeRequireSuggestedPackagesTruePositiveRateUpperTriFactor

Dependencies:abindapeclicolorspacedata.tabledigestexpmfansifarverggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmgcvmunsellmvtnormnlmepillarpkgconfigR6RColorBrewerRcpprlangscalestibbleutf8vctrsviridisLitewithrxtable

Creating a Custom Model in the PCMBase Framework

Rendered fromPCMCreateModel.Rmdusingknitr::rmarkdownon Oct 29 2024.

Last update: 2024-05-15
Started: 2019-04-08

Getting Started with the PCMBase R-package

Rendered fromPCMBase.Rmdusingknitr::rmarkdownon Oct 29 2024.

Last update: 2024-03-10
Started: 2018-10-31

The PCMBase Parametrization API

Rendered fromPCMParam.Rmdusingknitr::rmarkdownon Oct 29 2024.

Last update: 2024-03-10
Started: 2018-10-31

Tracing the likelihood calculation of a Gaussian model

Rendered fromPCMTracePruning.Rmdusingknitr::rmarkdownon Oct 29 2024.

Last update: 2024-03-10
Started: 2019-07-05

Readme and manuals

Help Manual

Help pageTopics
Arguments to be passed to the constructor MixedGaussian when constructing a MGPM model with some of the default MGPM model types.Args_MixedGaussian_MGPMDefaultModelTypes
Arguments for the MixedGaussian constructor for scalar OU MGPM models.Args_MixedGaussian_MGPMScalarOUType
Arguments for the MixedGaussian constructor for SURFACE OU MGPM models.Args_MixedGaussian_MGPMSurfaceOUType
Convert a 'GaussianPCM' model object to a 'MixedGaussian' model objectas.MixedGaussian
Data for Fig3 in the TPB manuscriptdataFig3
Latex representation of a model parameter or other found in a data.table objectFormatCellAsLatex
Latex representation of a data.table with matrix and vectors in its cellsFormatTableAsLatex
Check if an object is a `GaussianPCM`is.GaussianPCM
Check if an object is a `MixedGaussian` PCMis.MixedGaussian
Check if an object is a PCM.is.PCM
Check that a tree is a PCMTreeis.PCMTree
Find the members in a list matching a member expressionMatchListMembers
Class name for the scalar OU MGPM model typeMGPMScalarOUType
Class name for the SURFACE OU MGPM model typeMGPMSurfaceOUType
Create a multi-regime Gaussian model (MixedGaussian)MixedGaussian
Create a template MixedGaussian object containing a regime for each model typeMixedGaussianTemplate
Create a phylogenetic comparative model objectPCM
Quadratic polynomial parameters A, b, C, d, E, f for each nodePCMAbCdEf
Add a value to a list-valued attribute of a member or members matching a patternPCMAddToListAttribute
Map a parametrization to its original form.PCMApplyTransformation
Check if the PCMBase version corresponds to a dev releasePCMBaseIsADevRelease
Test objects for the PCMBase packagePCMBaseTestObjects
A fixed palette of n colorsPCMColorPalette
Combine all member attributes of a given name into a listPCMCombineListAttribute
Conditional distribution of a daughter node given its parent nodePCMCond
Conditional distribution of a daughter node given its parent nodePCMCond.GaussianPCM
Variance-covariance matrix of an OU process with optional measurement error and jump at the startPCMCondVOU
Create a likelihood function of a numerical vector parameterPCMCreateLikelihood
Class names for the the default PCM and MGPM model typesMGPMDefaultModelTypes PCMDefaultModelTypes
Generate a default object of a given PCM model type or parameter typePCMDefaultObject
Human friendly description of a PCMPCMDescribe
Describe the parameters of a PCMPCMDescribeParameters
Given a PCM or a parameter object, extract an analogical object for a subset of the dimensions (traits) in the original object.PCMExtractDimensions
Given a PCM or a parameter object, extract an analogical object for a subset of the regimes in the original object.PCMExtractRegimes
Find the S3 method for a given PCM object or class-name and an S3 genericPCMFindMethod
Fix a parameter in a PCM modelPCMFixParameter
Generate default model types for given PCM base-classesPCMGenerateModelTypes
Generate possible parameterizations for a given type of modelPCMGenerateParameterizations
Value of an attribute of an object or values for an attribute found in its membersPCMGetAttribute
Get a vector of all parameters (real and discrete) describing a model on a tree including the numerical parameters of each model regime, the integer ids of the splitting nodes defining the regimes on the tree and the integer ids of the model types associated with each regime.PCMGetVecParamsRegimesAndModels
Meta-information about a tree and trait data associated with a PCMPCMInfo
Likelihood of a multivariate Gaussian phylogenetic comparative model with non-interacting lineagesPCMLik
Calculate the likelihood of a model using the standard formula for multivariate pdfPCMLikDmvNorm
Tracing the log-likelihood calculation of a model over each node of the treePCMLikTrace
A vector of access-code strings to all members of a named listPCMListMembers
Specify the parameterizations for each parameter of a modelPCMListDefaultParameterizations PCMListParameterizations
Quadratic polynomial parameters L, m, rPCMLmr
Integer vector giving the model type index for each regimePCMMapModelTypesToRegimes
Expected mean vector at each tip conditioned on a trait-value vector at the rootPCMMean
Calculate the mean at time t, given X0, under a PCM modelPCMMeanAtTime
Get a list of PCM models currently implementedPCMModels
Get the model type(s) of a modelPCMModelTypes
Number of regimes in a objPCMNumRegimes
Number of traits modeled by a PCMPCMNumTraits
Global options for the PCMBase packagePCMOptions
Sums of pairs of elements in a vectorPCMPairSums
Module PCMParamPCMParam
Bind named vectors or matrices into an array so that the names form the names of the last dimension.PCMParamBindRegimeParams
Count the number of free parameters associated with a PCM or a PCM-parameterPCMParamCount
Get a vector of the variable numeric parameters in a modelPCMParamGetShortVector
Load (or store) a PCM parameter from (or to) a vector of the variable parameters in a model.PCMParamLoadOrStore
Locate a named parameter in the short vector representation of a modelPCMParamLocateInShortVector
The lower limit for a given model or parameter typePCMParamLowerLimit
Generate a random parameter vector for a model using uniform distribution between its lower and upper bounds.PCMParamRandomVecParams
Set model parameters from a named listPCMParamSetByName
Parameter typesis.AllEqual is.CholeskyFactor is.Diagonal is.Fixed is.Global is.Identity is.Local is.LowerTriangular is.LowerTriangularWithDiagonal is.MatrixParameter is.NonNegative is.Omitted is.Ones is.ScalarDiagonal is.ScalarParameter is.Schur is.SemiPositiveDefinite is.Symmetric is.Transformable is.Transformed is.UpperTriangular is.UpperTriangularWithDiagonal is.VectorParameter is.WithCustomVecParams is.WithNonNegativeDiagonal is.Zeros PCMParamType
The upper limit for a given model or parameter typePCMParamUpperLimit
Parent S3 classes for a model classPCMParentClasses
Extract error information from a formatted error message.PCMParseErrorMessage
Create a function of time that calculates (1-exp(-lambda_ij*time))/lambda_ij for every element lambda_ij of the input matrix Lambda_ij.PCMPExpxMeanExp
Eigen-decomposition of a matrix HPCMPLambdaP_1
A 2D Gaussian distribution density grid in the form of a ggplot objectPCMPlotGaussianDensityGrid2D
A 2D sample from Gaussian distributionPCMPlotGaussianSample2D
Beautiful model description based on plotmathPCMPlotMath
Scatter plot of 2-dimensional dataPCMPlotTraitData2D
Determine which traits are present (active) on each node of the treePCMPresentCoordinates
Get the regimes (aka colors) of a PCM or of a PCMTree objectPCMRegimes
Set an attribute of a named member in a PCM or other named list objectPCMSetAttribute
Simulation of a phylogenetic comparative model on a treePCMSim
Parameter specification of PCM modelPCMSpecify
A data.table representation of a PCM objectPCMTable
Cartesian product of possible parameterizations for the different parameters of a modelPCMTableParameterizations
Generate a trajectory for the mean in one regime of a PCMPCMTrajectory
Create a PCMTree object from a phylo objectPCMTree
Prune the tree leaving one tip for each or some of its partsPCMTreeBackbonePartition
Drop a clade from a phylogenetic treePCMTreeDropClade
A data.table with time, part and regime information for the nodes in a treePCMTreeDtNodes
A matrix with the begin and end time from the root for each edge in treePCMTreeEdgeTimes
Perfrorm nested extractions or drops of clades from a treePCMTreeEvalNestedEDxOnTree
Extract a clade from phylogenetic treePCMTreeExtractClade
The length of the branch leading to a nodePCMTreeGetBranchLength
A vector of the daughter nodes for a given parent node id in a treePCMTreeGetDaughters
Node labels of a treePCMTreeGetLabels PCMTreeGetNodeLabels PCMTreeGetRootLabel PCMTreeGetTipLabels
The parent node id of a daughter node in a treePCMTreeGetParent
Get the starting branch' nodes for each part on a treePCMTreeGetPartition
Unique parts on a tree in the order of occurrence from the root to the tips (preorder)PCMTreeGetPartNames
Regime mapping for the parts in a treePCMTreeGetPartRegimes
Get the parts of the branches leading to a set of nodes or tipsPCMTreeGetPartsForNodes
Model regimes (i.e. colors) associated with the branches in a treePCMTreeGetRegimesForEdges
Get the regimes of the branches leading to a set of nodes or tipsPCMTreeGetRegimesForNodes
Get the tips belonging to a part in a treePCMTreeGetTipsInPart
Get the tips belonging to a regime in a treePCMTreeGetTipsInRegime
Insert tips or singleton nodes on chosen edgesPCMTreeInsertSingletons PCMTreeInsertSingletonsAtEpoch PCMTreeInsertTipsOrSingletons
Jumps in modeled traits associated with branches in a treePCMTreeJumps
A list of all possible (including recursive) partitions of a treePCMTreeListAllPartitions
A list of all possible clade partitions of a tree with a number of splitting nodesPCMTreeListCladePartitions
A list of the descendants for each node in a treePCMTreeListDescendants
A list of the path to the root from each node in a treePCMTreeListRootPaths
Find the crossing points of an epoch-time with each lineage of a treePCMTreeLocateEpochOnBranches
Find the middle point of each branch longer than a thresholdPCMTreeLocateMidpointsOnBranches
Get the node numbers associated with tip- or node-labels in a treePCMTreeMatchLabels
Which couples from a given set of nodes in a tree belong to the same part?PCMTreeMatrixNodesInSamePart PCMTreeMatrixNodesInSameRegime
Find the nearest node to a given time from the root (epoch) on each lineage crossing this epochPCMTreeNearestNodesToEpoch
Calculate the time from the root to each node of the treePCMTreeNodeTimes
Number of all nodes in a treePCMTreeNumNodes
Number of unique parts on a treePCMTreeNumParts
Wrapper for length(tree$tip.label)PCMTreeNumTips
Plot a tree with parts and regimes assigned to these partsPCMTreePlot
Post-order tree traversalPCMTreePostorder
Pre-order tree traversalPCMTreePreorder
Set tip and internal node labels in a treePCMTreeSetLabels
Set a partition of a tree by specifying the partition nodesPCMTreeSetPartition
Set regimes for the parts in a treePCMTreeSetPartRegimes
Set the regime for each individual edge in a tree explicitlyPCMTreeSetRegimesForEdges
Slit a tree at a given internal node into a clade rooted at this node and the remaining tree after dropping this cladePCMTreeSplitAtNode
A matrix (table) of ancestors/descendants for each node in a treePCMTreeTableAncestors
A character representation of a phylo object.PCMTreeToString
Phylogenetic Variance-covariance matrixPCMTreeVCV
Unfix a parameter in a PCM modelPCMUnfixParameter
Expected variance-covariance matrix for each couple of tips (i,j)PCMVar
Calculate the variance covariance k x k matrix at time t, under a PCM modelPCMVarAtTime
Check if all packages listed in Suggests are availableRequireSuggestedPackages
True positive rate of a set of binary predictions against their truesFalsePositiveRate TruePositiveRate
Upper triangular factor of a symmetric positive definite matrixUpperTriFactor
White Gaussian PCM ignoring phylogenetic historyWhite