binomest {MCPAN}R Documentation

Only for internal use.

Description

Groupwise point and variance estimates for binomials, if data are given as numeric vectors of successes x and trials n, with I the number of levels in the one-way layout

Usage

binomest(x, ...)

## Default S3 method:
binomest(x, n, names=NULL, method="Wald", success=NULL, ...)

## S3 method for class 'formula':
binomest(formula, data, method="Wald", success=NULL, ...)

## S3 method for class 'table':
binomest(x, method="Wald", success=NULL, ...)

Arguments

x either a numeric vector of the number of successes, then n must be specified, or an object of class "table" as can be obtained by using table on a data.frame with to categorical variables
n a numeric vector of the number of trials, only needed, if x is a numeric vector
names optional character vector of group names (labels for later output), must have the same length as x and n
formula
data a data.frame, containing the variables specified in formula
method a character string, specifying the method for variance estimator, with options "Wald","ADD1","ADD2"
success an optional character string, to indicate the level considered as success if data are given as table, or data.frame, or, serving as label for the event considered as success in later functions
... currently not used

Details

Only for internal use.

Value

Y a numeric vector of the groupwise number of successes
n a numeric vector of the groupwise number of trials (observations)
estimate a numeric vector of groupwise point estimates, Y/n
estp a numeric vector of groupwise interval midpoints
varp a numeric vector of groupwise variance estimators, to be used for CI construction
varcor a numeric vector of groupwise variance estimators, to be used for correlation structures and test these values are adjusted to be larger than zero also in cases where Y=0 or Y=n
names a character vector of the level names of f
success

Author(s)

Frank Schaarschmidt

Examples


# if data are available as counts:

nsuccess<-c(1,2,6,8)
ntrials<-c(20,20,20,20)
binomest(x=nsuccess, n=ntrials)

binomest(x=nsuccess, n=ntrials, names=c("Control", "A", "B", "C"))

# if data are available as data.frame with categorical response variable
# and factor as grouping variable 

data(liarozole)
binomest(Improved ~ Treatment, data=liarozole)
binomest(Improved ~ Treatment, data=liarozole, success="y")

# if data are available as table
# and factor as grouping variable 

data(liarozole)
tab<-table(liarozole)

binomest(tab)
binomest(tab, success="y")


[Package MCPAN Index]