zconf {asbio} | R Documentation |
These functions calculate t and Z confidence intervals for mu. Z confidence intervals require specification of sigma. Both methods assume underlying normal distributions. Finite population corrections are provided if requested.
zconf(data, conf = 0.95, sigma, summarized = FALSE, xbar = NULL, fpc = FALSE, N = NULL, n = NULL) tconf(data, conf = 0.95, summarized = FALSE, xbar = NULL, st.dev = NULL, n = NULL, fpc = FALSE, N = NULL)
data |
A vector of quantitative data. Required if summarized = FALSE |
conf |
Confidence level; 1 - alpha. |
sigma |
The population standard deviation. |
summarized |
A logical statement specifying whether statistical summaries are to be used. If summarized = FALSE , then the sample mean and the sample standard deviation (t.conf only) are calculated from the vector provided in data . If summarized = FALSE then the sample mean xbar , the sample size n , and, in the case of t.conf , the sample standard deviation st.dev , must be provided by the user. |
xbar |
The sample mean. Required if summarized = TRUE . |
fpc |
A logical statement specifying whether a finite population correction should be made. If fpc = TRUE then both the sample size n and the population size N must be specified. |
N |
The population size. Required if fpc=TRUE |
st.dev |
The sample standard deviation. Required if summarized=TRUE . |
n |
The sample size. Required if summarized = TRUE . |
Z.conf
and t.conf
calculate confidence intervals for either summarized data or a
dataset provided in data
. Finite population corrections are made if a user specifies fpc=TRUE
and
specifies some value for N
.
Returns a list
Margin |
the confidence margin |
CI |
the upper and lower confidence bounds |
Ken Aho
Lohr, S. L. (1999) Sampling: design and analysis. Duxbury Press. Pacific Grove, USA.
#With summarized=FALSE x<-c(5,10,5,20,30,15,20,25,0,5,10,5,7,10,20,40,30,40,10,5,0,0,3,20,30) zconf(x,conf=.95,sigma=4,summarized=FALSE) tconf(x,conf=.95,summarized=FALSE) #With summarized = TRUE zconf(x,conf=.95,sigma=4,xbar=14.6,n=25,summarized=TRUE) tconf(x,conf=.95,st.dev=4,xbar=14.6,n=25,summarized=TRUE) #with finite population correction and summarized = TRUE zconf(x,conf=.95,sigma=4,xbar=14.6,n=25,summarized=TRUE,fpc=TRUE,N=100) tconf(x,conf=.95,st.dev=4,xbar=14.6,n=25,summarized=TRUE,fpc=TRUE,N=100)