computeCI: Return selective confidence interval for v^T mu (a single...

View source: R/conf_int_funs.R

computeCIR Documentation

Return selective confidence interval for v^T mu (a single parameter). Not typically needed by users.

Description

Compute selective confidence interval for parameter v^T mu based on a truncated normal distribution. A slight modification of code found in the Outference package, available at https://github.com/shuxiaoc/outference. This function shouldn't be needed by most users (it is called internally by branchInference), but is needed to reproduce our paper simulations.

Usage

computeCI(v, y, sigma = NULL, truncation, alpha = 0.05)

Arguments

v

the vector that defines the parameter of interest; v^T mu

y

the observed response vector

sigma

The known noise standard deviation. If unknown, we recommend a conservative estimate. If it is left blank, we automatically use a conservative estimate.

truncation,

the truncation set for the statistic v'y. Computes a confidence interval for the mean of a truncated normal distribution.

alpha,

the significance level.

Value

This function returns a vector of lower and upper confidence limits.

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)
full_result <- branchInference(bls.tree, branch, type="sib")
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)

computeCI(nu_sib, blsdata$kcal24h0, sd(blsdata$kcal24h0),S_sib)
full_result$confint

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