binomtestGC function

Exact Procedures for a Single Proportion

Exact Procedures for a Single Proportion

Wrapper for binom.test in package stats. Employs the binomial distribution in inferential procedures for a single proportion.

binomtestGC(x,data=parent.frame(),n=numeric(),p=NULL, alternative=c("two.sided","less","greater"), success="yes",conf.level=0.95,graph=FALSE,verbose=TRUE)

Arguments

  • x: Either a formula or a numeric vector. If formula, it must be of the form ~x indicating the single variable under study. When summary data are provided, x is a numeric vector of success counts.
  • data: Data frame that supplies the variable x. If not found in data, the variable is searched for in the parent environment.
  • n: When not empty, this is a numeric vector giving the size of the sample.
  • p: Specifies Null Hypothesis value for population proportion. If not set, no test is performed.
  • alternative: "two.sided" requests computation of a two-sided P-value; other possible values are "less" and "greater".
  • success: When x is a formula, this argument indicates which value of variable x is being counted as a success. When working with formula-data input the value of this parameter MUST be set, even when the variable has only two values.
  • conf.level: Number between 0 and 1 indicating the confidence-level of the interval supplied.
  • graph: If TRUE, plot graph of P-value. Ignored if no test is performed.
  • verbose: Determines whether to return lots of information or only the basics

Returns

an object of class GCbinomtest.

Examples

#Confidence interval only: binomtestGC(~sex,data=m111survey,success="female") #Confidence interval and two-sided test, Null Hypothesis p = 0.5: binomtestGC(~sex,data=m111survey,success="female",p=0.5) #For confidence level other than 95%, use conf.level argument. #For 90% interval: binomtestGC(~sex,data=m111survey,success="female",conf.level=0.90) #For one-sided test, set alternative argument as desired: binomtestGC(~sex,data=m111survey,p=0.50, success="female",alternative="greater") #Summary data: #In one sample, 40 successes in 100 trials. Testing whether p = 0.45. binomtestGC(x=40,n=100,p=0.45)

Author(s)

Homer White hwhite0@georgetowncollege.edu

  • Maintainer: Homer White
  • License: GPL (>= 3)
  • Last published: 2020-06-15

Useful links