SD {EdSurvey}R Documentation

EdSurvey Standard Deviation


Calculate the standard deviation of a numeric variable in an


  weightVar = NULL,
  jrrIMax = 1,
  varMethod = "jackknife",
  omittedLevels = TRUE,
  defaultConditions = TRUE,
  recode = NULL,
  targetLevel = NULL,
  jkSumMultiplier = getAttributes(data, "jkSumMultiplier"),
  returnVarEstInputs = FALSE



an, an, or a


character vector of variable names


character weight variable name. Default is the default weight of data if it exists. If the given survey data do not have a default weight, the function will produce unweighted statistics instead. Can be set to NULL to return unweighted statistics.


a numeric value; when using the jackknife variance estimation method, the default estimation option, jrrIMax=1, uses the sampling variance from the first plausible value as the component for sampling variance estimation. The Vjrr term (see Statistical Methods Used in EdSurvey) can be estimated with any number of plausible values, and values larger than the number of plausible values on the survey (including Inf) will result in all plausible values being used. Higher values of jrrIMax lead to longer computing times and more accurate variance estimates.


deprecated parameter; gap always uses the jackknife variance estimation


a logical value. When set to TRUE, drops those levels of the specified variable. Use print on an to see the omitted levels. Defaults to FALSE.


a logical value. When set to the default value of TRUE, uses the default conditions stored in an to subset the data. Use print on an to see the default conditions.


a list of lists to recode variables. Defaults to NULL. Can be set as recode = list(var1 = list(from = c("a","b","c"), to = "d")).


a character string. When specified, calculates the gap in the percentage of students at targetLevel in the variable argument, which is useful for comparing the gap in the percentage of students at a survey response level.


when the jackknife variance estimation method—or balanced repeated replication (BRR) method—multiplies the final jackknife variance estimate by a value, set jkSumMultiplier to that value. For an, or a, the recommended value can be recovered with EdSurvey::getAttributes(myData, "jkSumMultiplier").


a logical value set to TRUE to return the inputs to the jackknife and imputation variance estimates, which allows for the computation of covariances between estimates.


a list object with elements:


the mean assessment score for variable, calculated according to the vignette titled Statistical Methods Used in EdSurvey


the standard deviation of the mean


the standard error of the std


the degrees of freedom of the std


the variance estimate inputs used for calculating covariances with varEstToCov. Only returned with returnVarEstInputs is TRUE


Paul Bailey and Huade Huo


## Not run: 
# read in the example data (generated, not real student data)
sdf <- readNAEP(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
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 <-, sdfB, sdfC, sdfD),
                                 labels=c("A locations",
                                          "B locations",
                                          "C locations",
                                          "D locations"))

# this shows how these datasets will be described:

# 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)

[Package EdSurvey version 2.7.1 Index]