# twostageTE-package: Threshold value estimation using two-stage plans In twostageTE: Two-Stage Threshold Estimation

## Description

This package implements a variety of nonparametric methods for computing one-stage and two-stage confidence intervals and point estimates of threshold values.

## Details

 Package: twostageTE Type: Package Version: 1.0 Date: 2013-05-23 License: GPL-2

The user interacts with the package by utilizing two functions: stageOneAnalysis and stageTwoAnalysis. These functions take the sampled explanatory variable and corresponding responses at the first and second stage, respectively, and outputs point estimate and confidence intervals based on different user specific procedures.

## Author(s)

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34``` ```## Simulating the (wiggly) isotonic Sine function ## sampleData=function(n, lower, upper) { x=runif(n, lower, upper) y=(1/40)*sin(6*pi*x) + 1/4 + x/2 + (1/4)*x^2 + rnorm(n=length(x), sd=0.1) return(list(X=x, Y=y)) } Budget=100 d0=0.5 threshold = (1/40)*sin(6*pi*d0) + 1/4 + d0/2 + (1/4)*d0^2 n1=floor(Budget*0.25) n2=Budget - n1 samp = sampleData(n1, lower=0, upper=1) X = samp\$X Y = samp\$Y ## Two Stage IR+IR ## stageOne_IR=stageOneAnalysis(X, Y, threshold, type="IR-wald", 0.99) samp2 = sampleData(n2, lower=stageOne_IR\$L1, upper=stageOne_IR\$U1) X2 = samp2\$X Y2 = samp2\$Y twoStageIR = stageTwoAnalysis(stageOne_IR, X2, Y2, type="IR-wald", 0.95) ## Two Stage LR+LR ## stageOne_LR=stageOneAnalysis(X, Y, threshold, type="IR-likelihood", 0.99) samp2 = sampleData(n2, lower=stageOne_LR\$L1, upper=stageOne_LR\$U1) X2 = samp2\$X Y2 = samp2\$Y twoStageLR = stageTwoAnalysis(stageOne_LR, X2, Y2, type="IR-likelihood", 0.95) ## Two Stage IR+Local Linear ## X2 = c(rep(stageOne_IR\$L1,37),rep(stageOne_IR\$U1,38)) Y2=X2^2+rnorm(n=length(X2), sd=0.1) twoStageLinear=stageTwoAnalysis(stageOne_IR, explanatory = X2, response = Y2, type = "locLinear", level = 0.95) ```