Skip to contents

This function computes a selective confidence interval for a regression coefficient by identifying the values of the parameter for which the selective p-value equals the specified significance level.

Usage

get_CI(pselb, point_est, naive_se_est, alpha)

Arguments

pselb

A function that returns the selective p-value for a given value of the parameter.

point_est

The point estimate of the parameter (typically the selective MLE).

naive_se_est

The naive standard error of the estimate.

alpha

The significance level for the confidence interval (default is 0.05).

Value

A numeric vector of length 2 giving the lower and upper bounds of the selective confidence interval.

Details

This function computes the lower and upper bounds of a confidence interval by solving for values of the parameter where the selective p-value equals the significance level alpha.

The search is performed using uniroot, which finds roots of the function defined as the difference between the selective p-value and alpha. The function expands the search range iteratively if a root is not initially found in the given interval.

If the selective p-value at the point estimate is less than or equal to alpha, the interval is considered valid. If not, an empty or infinite interval may be returned, with a warning printed.