SD | R Documentation |
Calculate the standard deviation of a numeric variable in an edsurvey.data.frame
.
SD(
data,
variable,
weightVar = NULL,
jrrIMax = 1,
varMethod = "jackknife",
dropOmittedLevels = TRUE,
defaultConditions = TRUE,
recode = NULL,
targetLevel = NULL,
jkSumMultiplier = getAttributes(data, "jkSumMultiplier"),
returnVarEstInputs = FALSE,
omittedLevels = deprecated()
)
data |
an |
variable |
character vector of variable names |
weightVar |
character weight variable name. Default is the default weight of |
jrrIMax |
a numeric value; when using the jackknife variance estimation method, the default estimation option, |
varMethod |
deprecated parameter; |
dropOmittedLevels |
a logical value. When set to |
defaultConditions |
a logical value. When set to the default value of
|
recode |
a list of lists to recode variables. Defaults to |
targetLevel |
a character string. When specified, calculates the gap in
the percentage of students at
|
jkSumMultiplier |
when the jackknife variance estimation method—or
balanced repeated replication (BRR)
method—multiplies the final jackknife variance estimate by a value,
set |
returnVarEstInputs |
a logical value set to |
omittedLevels |
this argument is deprecated. Use |
a list object with elements:
mean |
the mean assessment score for |
std |
the standard deviation of the |
stdSE |
the standard error of the |
df |
the degrees of freedom of the |
varEstInputs |
the variance estimate inputs used for calculating covariances with |
Paul Bailey and Huade Huo
## Not run:
# read in the example data (generated, not real student data)
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package="NAEPprimer"))
# get standard deviation for Male's composite score
SD(data = subset(sdf, dsex == "Male"), variable = "composite")
# get several standard deviations
# build an edsurvey.data.frame.list
sdfA <- subset(sdf, scrpsu %in% c(5,45,56))
sdfB <- subset(sdf, scrpsu %in% c(75,76,78))
sdfC <- subset(sdf, scrpsu %in% 100:200)
sdfD <- subset(sdf, scrpsu %in% 201:300)
sdfl <- edsurvey.data.frame.list(datalist=list(sdfA, sdfB, sdfC, sdfD),
labels=c("A locations",
"B locations",
"C locations",
"D locations"))
# this shows how these datasets will be described:
sdfl$covs
# SD results for each survey
SD(data = sdfl, variable = "composite")
# SD results more compactly and with comparisons
gap(variable="composite", data=sdfl, stDev=TRUE, returnSimpleDoF=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.