Learn R Programming

coala (version 0.7.2)

sumstat_class: Base Class for Summary Statistics

Description

Base Class for Summary Statistics

Base Class for Summary Statistics

Arguments

Super class

coala::coalmodelpart -> sumstat

Methods


Method new()

Initialization of $sumstat

Usage

sumstat_class$new(name, transformation)

Arguments

name

the name to be used for this statistic

transformation

transformation to be used for this statistic

Returns

NULL


Method calculate()

This function must be overwritten in the derived class

Usage

sumstat_class$calculate(seg_sites, trees, files, model)

Arguments

seg_sites

seg_sites object containing the segregating sites

trees

trees

files

files

model

demographic model

Returns

NULL


Method check()

Optional functions that checks if a model is compatible with the stat.

In a derived class this can be overwritten by a function that throws an informative error if the model is incompatible with the statistic The function is executed before the statistic is added to the model.

Usage

sumstat_class$check(model)

Arguments

model

demographic model

Returns

invisible TRUE


Method get_name()

function to read the private attribute name

Usage

sumstat_class$get_name()

Returns

name of the statistic


Method requires_files()

function to check whether files are required by this statsitic

Usage

sumstat_class$requires_files()

Returns

req_files, which is TRUE or FALSE and indicates whether files are required by this statsitic


Method requires_segsites()

function to check whether segregating sites are required by this statsitic

Usage

sumstat_class$requires_segsites()

Returns

req_segsites, which is TRUE or FALSE and indicates whether segregating sites are required by this statsiti


Method requires_trees()

function to check whether trees are required by this statsitic

Usage

sumstat_class$requires_trees()

Returns

req_trees, which is TRUE or FALSE and indicates whether trees are required by this statsitic


Method print()

function to print the class of the statistic

Usage

sumstat_class$print()


Method transform()

Transformation that is applied to the statistic

Usage

sumstat_class$transform(x)

Arguments

x

untransformed value

Returns

transformed value


Method clone()

The objects of this class are cloneable with this method.

Usage

sumstat_class$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

If you want to create additional summary statistics for coala, create R6 classes that inherit from this object.