getInterval: Workhorse function for computing conditioning sets. Not...

View source: R/phi_interval_funs.R

getIntervalR Documentation

Workhorse function for computing conditioning sets. Not typically needed by users.

Description

Returns the interval for phi such that Tree(y'(phi,nu)) contains the set of regions induced by branch branch. An rpart object built with model=TRUE must be provided. This function shouldn't be needed by most users (it is called internally by branchInference), but is needed to reproduce our paper simulations.

Usage

getInterval(tree, nu, branch, sib = FALSE, grow = FALSE, prune = FALSE)

Arguments

tree

An rpart object. Must have been built with model=TRUE argument.

nu

The vector that defines the parameter nu^T mu.

branch

A vector of strings specifying the branch.

sib

If you are doing inference and nu=nu_sib, this takes advantage of some computational speedups!

grow

Set this to true if you only want to compute S_grow (ignore cost complexity pruning).

prune

Set this to true if you only want to see what gets REMOVED from S_grow during pruning

Value

an object of class Interval that defines the set S.

Examples

data(blsdata, package="treevalues")
bls.tree <-rpart::rpart(kcal24h0~hunger+disinhibition+resteating+rrvfood+liking+wanting,
      model = TRUE, data = blsdata, cp=0.02)
branch <- getBranch(bls.tree, 2)
left_child <- getRegion(bls.tree,2)
right_child <- getRegion(bls.tree,3)
nu_sib <- left_child/sum(left_child) -  right_child/sum(right_child)
S_sib <- getInterval(bls.tree, nu_sib,branch)
S_sib
branchInference(bls.tree, branch, type="sib")$condset

anna-neufeld/treevalues documentation built on Sept. 21, 2023, 8:45 p.m.