correctPVal | R Documentation |
Based on the similar function from the Outference package,
which accomplishes a similar task. Code modified from code found 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.
correctPVal(phiInterval, nu, y, sigma)
phiInterval |
the conditioning set (truncation interval). An object of class |
nu |
the vector that defines the parameter of interest. We are testing the hypothesis that nu^T mu = 0. |
y |
the response data y. |
sigma |
the (assumed known) noise standard deviation. The assumption is that y_i ~ N(mu_i, sigma^2). |
a p-value.
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)
correctPVal(S_sib, nu_sib, blsdata$kcal24h0, sd(blsdata$kcal24h0))
# Same answer as using branchInference()
branchInference(bls.tree, branch, type="sib")$pval
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.