stageOneAnalysis: Stage one analysis

Description Usage Arguments Value Author(s) See Also Examples

View source: R/stageOneAnalysis.R

Description

Wrapper function for twoStageTE that users can directly call on their data.

Usage

1
2
stageOneAnalysis(explanatory, response, threshold, 
    type = "IR-wald", level = 0.99)

Arguments

explanatory

Explanatory sample points

response

Observed responses at the explanatory sample points

threshold

Threshold of interest

type

String input of either "IR-wald" (default) or "IR-likelihood"

level

Desired confidence level (defaults to 0.99)

Value

List:

L1

Lower bound of CI

U1

Upper bound of CI

estimate

Threshold estimate

level

Confidence level

X1

First stage explanatory variable

Y1

First stage response variable

X2

NA

Y2

NA

L2

NA

U2

NA

call

Method call

sigmaSq

Estimate of variance

deriv_d0

Derivative estimate

class

twostageTE

Author(s)

Shawn Mankad

See Also

See Also as stageTwoAnalysis, ~~~

Examples

 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
35
36
37
38
39
X=runif(25, 0,1)
Y=X^2+rnorm(n=length(X), sd=0.1)
oneStage_IR=stageOneAnalysis(X, Y, 0.25, type="IR-wald", 0.99)

## The function is currently defined as
function (explanatory, response, threshold, type = "IR-wald", 
    level = 0.99) 
{
    cl1 <- match.call(expand.dots = TRUE)
    if (type == "IR-wald") {
        CI = waldConfidenceInterval_ir_stageOne(explanatory, 
            response, threshold, level = level)
        return(structure(list(L1 = CI$lower, U1 = CI$upper, estimate = CI$estimate, 
            C_1 = CI$C_1, threshold = threshold, level = level, 
            X1 = explanatory, Y1 = response, X2 = NA, Y2 = NA, 
            L2 = NA, U2 = NA, call = cl1, sigmaSq = CI$sigmaSq, 
            deriv_d0 = CI$deriv_d0), class = "twostageTE"))
    }
    else if (type == "IR-likelihood") {
        CI = likelihoodConfidenceInterval(explanatory, response, 
            threshold, level = level)
        return(structure(list(L1 = CI$lower, U1 = CI$upper, estimate = CI$estimate, 
            threshold = threshold, level = level, X1 = explanatory, 
            Y1 = response, X2 = NA, Y2 = NA, L2 = NA, U2 = NA, 
            call = cl1, sigmaSq = CI$sigmaSq, deriv_d0 = CI$deriv_d0), 
            class = "twostageTE"))
    }
    else if (type == "SIR") {
        CI = waldConfidenceInterval_sir_stageOne(explanatory, 
            response, threshold, level = level)
        return(structure(list(L1 = CI$lower, U1 = CI$upper, estimate = CI$estimate, 
            threshold = threshold, level = level, X1 = explanatory, 
            Y1 = response, X2 = NA, Y2 = NA, L2 = NA, U2 = NA, 
            call = cl1, sigmaSq = CI$sigmaSq, deriv_d0 = CI$deriv_d0), 
            class = "twostageTE"))
    }
    else error("stageOneAnalysis: type should be either 'IR-wald',
        'IR-likelihood' or 'SIR'")
  }

twostageTE documentation built on May 1, 2019, 9:18 p.m.