View source: R/edsurveyTable.R
edsurveyTable  R Documentation 
Returns a summary table (as a data.frame
)
that shows the number of students, the percentage of students, and the mean
value of the outcome (or lefthand side) variable by the
predictor (or righthand side) variable(s).
edsurveyTable(
formula,
data,
weightVar = NULL,
jrrIMax = 1,
pctAggregationLevel = NULL,
returnMeans = TRUE,
returnSepct = TRUE,
varMethod = c("jackknife", "Taylor"),
drop = FALSE,
dropOmittedLevels = TRUE,
defaultConditions = TRUE,
recode = NULL,
returnVarEstInputs = FALSE,
omittedLevels = deprecated()
)
formula 
object of class 
data 
object of class 
weightVar 
character string indicating the weight variable to use.
Note that only the name of the
weight variable needs to be included here, and any
replicate weights will be automatically included.
When this argument is 
jrrIMax 
a numeric value; when using the jackknife variance estimation method, the default estimation option, 
pctAggregationLevel 
the percentage variable sums up to 100 for the first

returnMeans 
a logical value; set to 
returnSepct 
set to 
varMethod 
a character set to 
drop 
a logical value. When set to the default value of 
dropOmittedLevels 
a logical value. When set to the default value of 
defaultConditions 
a logical value. When set to the default value of 
recode 
a list of lists to recode variables. Defaults to 
returnVarEstInputs 
a logical value set to 
omittedLevels 
this argument is deprecated. Use 
This method can be used to generate a simple oneway, twoway, or nway table with unweighted and weighted n values and percentages. It also can calculate the average of the subject scale or subscale for students at each level of the crosstabulation table.
A detailed description of all statistics is given in the vignette titled Statistical Methods Used in EdSurvey.
A table with the following columns:
RHS levels 
one column for each righthand side variable. Each row regards students who are at the levels shown in that row. 
N 
count of the number of students in the survey in the 
WTD_N 
the weighted N count of students in the survey in 
PCT 
the percentage of students at the aggregation level specified by 
SE(PCT) 
the standard error of the percentage, accounting
for the survey sampling methodology. When 
MEAN 
the mean assessment score for units in the 
SE(MEAN) 
the standard error of the 
When returnVarEstInputs
is TRUE
, two additional elements are
returned. These are meanVarEstInputs
and pctVarEstInputs
and
regard the MEAN
and PCT
columns, respectively. These two
objects can be used for calculating covariances with
varEstToCov
.
Paul Bailey and Ahmad Emad
Binder, D. A. (1983). On the variances of asymptotically normal estimators from complex surveys. International Statistical Review, 51(3), 279–292.
Rubin, D. B. (1987). Multiple imputation for nonresponse in surveys. New York, NY: Wiley.
## Not run:
# read in the example data (generated, not real student data)
sdf < readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
# create a table that shows only the breakdown of dsex
edsurveyTable(formula=composite ~ dsex, data=sdf, returnMeans=FALSE, returnSepct=FALSE)
# create a table with composite scores by dsex
edsurveyTable(formula=composite ~ dsex, data=sdf)
# add a second variable
edsurveyTable(formula=composite ~ dsex + b017451, data=sdf)
# add a second variable, do not omit any levels
edsurveyTable(formula=composite ~ dsex + b017451 + b003501, data=sdf, omittedLevels=FALSE)
# add a second variable, do not omit any levels, change aggregation level
edsurveyTable(formula=composite ~ dsex + b017451 + b003501, data=sdf, omittedLevels=FALSE,
pctAggregationLevel=0)
edsurveyTable(formula=composite ~ dsex + b017451 + b003501, data=sdf, omittedLevels=FALSE,
pctAggregationLevel=1)
edsurveyTable(formula=composite ~ dsex + b017451 + b003501, data=sdf, omittedLevels=FALSE,
pctAggregationLevel=2)
# variance estimation using the Taylor series
edsurveyTable(formula=composite ~ dsex + b017451 + b003501, data=sdf, varMethod="Taylor")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.