`R/phi_interval_funs.R`

`getInterval.Rd`

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.

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

tree | An rpart object. Must have been built with |
---|---|

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 |

an object of class Interval that defines the set S.

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#> Object of class Intervals #> 2 intervals over R: #> (-Inf, -980.709890684641) #> (1591.88198272855, Inf)#> Object of class Intervals #> 2 intervals over R: #> (-Inf, -980.709890684641) #> (1591.88198272855, Inf)