pred.int: Generates predicted intervals for predicted interval plots

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Generates predicted intervals of some effect estimate given observed data and a hypothesis about the distribution of future data.

Usage

1
2
3
pred.int(y, group = NA, N, true.y = "observed", ref = NA, 
         data.type = c("t.test", "binary"), var.equal = FALSE, 
         conf.level = 0.95, obs.conf.level=NA, iters = 100)

Arguments

y

a numeric vector of outcomes (with at least 2 elements and no missing values)

group

an optional vector of groups. If it exists, it must be the same length as y with no missing values. If missing, all observations put in the same group, and one-sample analyses are performed. See 'Details' for more information.

N

A required vector with length equal to the number of distinct groups. The ith element is what we want the number of observations to be for the ith group after simulation. (So if y is length 150 and only one group, then to simulate 50 outcomes we pass N=200.)

true.y

Either "observed","no.diff", or a vector of constants. Define mean/proportion used when simulating the data.

ref

An optional group name that will serve as the reference group. Default is the first alphabetically.

data.type

A required field indicating the type of data/statistical test that should be performed to get the effect estimate. Either "t.test" or "binary"

var.equal

TRUE/FALSE whether to assume variance equal in t-test. Default is FALSE. This does not affect the variance used when simulating data. Data is always simulated with the variance for the group, not the pooled variance

conf.level

Confidence level for intervals (between 0 and 1). Default is 0.95. This is the confidence level used for the predicted intervals and will also define the confidence level used for the observed interval unless obs.conf.level is also used.

obs.conf.level

Confidence level for the observed intervals (between 0 and 1). Default is the same level specified for the predicted intervals in the conf.level parameter.

iters

Number of predicted intervals to generate. Default is 100

Details

The pred.int function takes a vector of observations (y) as well as (optionally) the group of each observation (group), and the total number of observations expected in each group (N) when all data is observed. The function then calculates the amount of data that needs to be simulated in each group, and simulates the outcome, which is either binary or normal depending on the value of data.type.

When simulating data, the parameter true.y determines the mean/proportion of the population from which the simulated data will be drawn. This is either the observed mean/proportion (true.y="observed"), the pooled mean/proportion (true.y="no.diff"), or a vector of constants (representing the mean/proportion in each group).

Selecting data.type="t.test" with more than one group generates confidence intervals using a t.test either under the assumption of equal variance if var.equal=TRUE or unequal variance if var.equal=FALSE. In the latter case the degrees of freedom are corrected using Satterthwaite's approximation.

Selecting data.type="binary" generates confidence intervals using a test for equality of proportions (similar to that calculated in prop.test). A continuity correction is not applied.

When there is more than one group, the program treats one group as the reference group and generates N-1 sets of predicted intervals (where N is the number of groups), where each group is compared to the reference group. When all the observations are in the same group (or no group vector was provided) one-sample tests are performed.

Value

An object of class pred.int is returned, which is a list of the following:

obs.mean

Observed mean for each group (vector with length = n(groups)

obs.n

Observed n for each group

sim.n

Number simulated for each group

ci

A list of vectors of length 3 that contain the point estimate, lower, and upper confidence intervals for the observed effect. There are n(groups)-1 elements in the list (one for each comparison/graph)

pi

A list of matrices with 3 columns and iters rows. The columns are the point estimate and lower/upper confidence limit for each predicted interval. There are (n(groups)-1) matrices in the list (one for each comparison/graph).

data.type

Data type (passed from input parameter)

conf.level

Confidence level used for predicted intervals (passed from input parameter)

obs.conf.level

Confidence level used for observed intervals (see obs.conf.level input parameter)

Author(s)

Daniel G. Muenz, Ray Griner rgriner@sdac.harvad.edu, Huichao Chen, Lijuan Deng, Sachiko Miyahara, and Scott R. Evans evans@sdac.harvard.edu, with contributions from Lingling Li, Hajime Uno, and Laura M. Smeaton.

See package documentation for affiliations and contributions.

References

Evans SR, Li L, Wei LJ, "Data Monitoring in Clinical Trials Using Prediction", Drug Information Journal, 41:733-742, 2007.

Li L, Evans SR, Uno H, Wei LJ. "Predicted Interval Plots: A Graphical Tool for Data Monitoring in Clinical Trials", Statistics in Biopharmaceutical Research, 1:4:348-355, 2009.

See Also

PIPS

plot.pred.int

print.pred.int

Examples

1
2
3
4
5
6
7
8
9
# Make some fake data
myY<-c(rep(1,times=20),rep(0,times=80),rep(1,times=25),rep(0,times=25))
myGroup<-c(rep('A',100),rep('B',50))

# Run the programs
pips <- pred.int(y=myY, group=myGroup, N=c(200,100), 
                 data.type="binary", iters=100)
print(pips)
plot(pips)

PIPS documentation built on May 1, 2019, 10:37 p.m.