invertci: Constructs confidence interval

View source: R/invertci.R

invertciR Documentation

Constructs confidence interval

Description

This function constructs the confidence interval using the bisection method.

Usage

invertci(
  f,
  farg = list(),
  alpha = 0.05,
  init.lb = NULL,
  init.ub = NULL,
  tol = 1e-04,
  max.iter = 20,
  pvals = NULL,
  dp = 5,
  progress = TRUE
)

Arguments

f

The function that represents a testing procedure.

farg

The list of arguments to be passed to the function of testing procedure.

alpha

The significance level(s). This can be a vector.

init.lb

The initial brackets to search for the lower bound. This is not required if the chorussell is used.

init.ub

The initial brackets to search for the upper bound. This is not required if the chorussell is used.

tol

The tolerance level in the bisection method.

max.iter

The maximum number of iterations in the bisection method.

pvals

The data frame that consists the points and the corresponding p-values that have been tested in the previous iterations.

dp

The number of decimal places in the output.

progress

The boolean variable for whether the result messages should be displayed in the procedure of constructing confidence interval. If it is set as TRUE, the messages are displayed throughout the procedure. Otherwise, the messages will not be displayed.

Details

The number of decimal places displayed in the messages (if progress is set as TRUE) is equal to the number of decimal places in the variable tol.

Value

Returns the confidence interval and a data frame that contains the points being tested in the procedure.

pvals

The data frame that consists of the points and the corresponding p-values that have been tested in constructing the confidence intervals.

df_ub

The data frame storing the information for the bisection method in each iteration when evaluating the upper bound of the confidence interval.

df_lb

The data frame storing the information for the bisection method in each iteration when evaluating the lower bound of the confidence interval.

alpha

The significance levels.

tol

The tolerance level in the bisection method.

iter

The total number of iterations taken.

call

The matched call.

para.name

The name of the tuning parameters involved.

para.vals

The values of the tuning parameters involved.

ci

The confidence intervals constructed.

Example

  source("./example/dgp_missingdata.R") # Change directory if necessary
  J <- 5
  N <- 1000
  data <- missingdata_draw(J = J, n = N, seed = 1, prob.obs = .5)
  lpm <- missingdata_lpm(J = J, info = "full", data = data)
  farg <- list(data = data,
               lpmodel = lpm,
               R = 100,
               phi = 2/3,
               solver = "gurobi",
               progress = FALSE)
  invertci(f = subsample,
           farg = farg,
           alpha = .05)

More examples

More examples can be found in the invertci_example.R file under the example subdirectory of the installation directory for the lpinfer package.


conroylau/lpinfer documentation built on Oct. 23, 2022, 9:21 a.m.