bfa_tree_gen {bifurcatingr} | R Documentation |
Bifurcating Autoregressive Tree generator
Description
This function generate bifurcating autoregressive (BFA) trees of any size based on a BFA model of any order.
Usage
bfa_tree_gen(n, p, s1, s2, r1, r2, g, intercept, ar_coef, dist = "cnorm", a)
Arguments
n |
tree size (integer) |
p |
an integer determining the order of bifurcating autoregressive model |
s1 |
standard deviation of the errors distribution |
s2 |
standard deviation of the second component of the mixture normal distribution generating contaminated errors. s2 should be greater than s1. s2 is only effective when g>0. |
r1 |
correlation between pairs of errors |
r2 |
is used in combination with |
g |
proportion of contamination when contaminated normal distribution is selected, or a positive value representing the degrees of freedom when skew t-student distribution is selected. Defaults to zero producing non-contaminated multivariate normal errors. |
intercept |
the intercept in the BAR model generating the tree |
ar_coef |
a vector of length p giving the autoregressive coefficients in the BAR model generating the tree |
dist |
determine the distribution of the error. Three distributions are available; Contaminated normal distribution "cnorm", Skew normal distribution "snorm", and Skew t-student distribution "st". |
a |
an integer which regulates the the slant of the density when skew normal distribution or skew t-student distribution is selected. Defaults to zero producing non-skewed multivariate normal errors, and non-skewed multivariate t-student errors for the tree generation. |
Value
A numeric vector representing a bifurcating autoregressive (BAR) tree
with n
observations.
Examples
# Non-contaminated normal BAR(1) tree:
bfa_tree_gen(127, 1, 1, 1, 0.5, 0.5, 0, 10, c(0.7))
# Non-contaminated normal BAR(2) tree:
bfa_tree_gen(127, 2, 1, 1, 0.5, 0.5, 0, 10, c(0.5, 0.3))
# Contaminated normal BAR(1) tree:
bfa_tree_gen(127, 1, 1, 2, 0.5, 0.5, 0.2, 10, c(0.7))
# BAR(1) tree with error generated from skewed normal distribution with skewness equals to -3:
bfa_tree_gen(127, 1, 1, 2, 0.5, 0.5, 0, 10, c(0.7),dist="snorm",-3)
# BAR(2) tree with error generated from skewed normal distribution with skewness equals to 3:
bfa_tree_gen(127, 2, 1, 2, 0.5, 0.5, 0, 10, c(0.7,0.5),dist="snorm",3)
# BAR(1) tree with error generated from skewed-t distribution with skewness equals
# to -3 and df equals to 10:
bfa_tree_gen(127, 1, 1, 2, 0.5, 0.5, 10, 10, c(0.7),dist="st",-3)
# BAR(2) tree with error generated from skewed-t distribution with skewness equals
# to 3 and df equals to 1:
bfa_tree_gen(127, 2, 1, 2, 0.5, 0.5, 10, 10, c(0.7,0.5),dist="st",3)