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)
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.
y
is length 150 and only one group, then to
simulate 50 outcomes we pass N
=200.)
obs.conf.level
is also used.
conf.level
parameter.
pred.int
is returned, which is a list of the following:
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).
obs.conf.level
input parameter)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.
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.
PIPS
# 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)
Run the code above in your browser using DataLab