DoFCorrection {EdSurvey} | R Documentation |

Calculates the degrees of freedom for a statistic (or of a contrast between two statistics) based on the jackknife and imputation variance estimates.

```
DoFCorrection(
varEstA,
varEstB = varEstA,
varA,
varB = varA,
method = c("WS", "JR")
)
```

`varEstA` |
the |

`varEstB` |
similar to the |

`varA` |
a character that names the statistic in the |

`varB` |
a character that names the statistic in the |

`method` |
a character that is either |

This calculation happens under the notion that statistics have little variance within strata, and some strata will contribute fewer than a full degree of freedom.

The functions are not vectorized, so both `varA`

and
`varB`

must contain exactly one variable name.

The method used to compute the degrees of freedom is in the vignette titled
*Statistical Methods Used in EdSurvey*
section “Estimation of Degrees of Freedom.”

numeric; the estimated degrees of freedom

Paul Bailey

Johnson, E. G., & Rust, K. F. (1992). Population inferences and variance estimation for NAEP data. *Journal of Educational Statistics,* *17,* 175–190.

```
## Not run:
sdf <- readNAEP(system.file("extdata/data", "M36NT2PM.dat", package="NAEPprimer"))
lm1 <- lm.sdf(composite ~ dsex + b017451, sdf, returnVarEstInputs=TRUE)
summary(lm1)
# this output agrees with summary of lm1 coefficient for dsex
DoFCorrection(lm1$varEstInputs,
varA="dsexFemale",
method="JR")
# second example, a covariance term requires more work
# first, estimate the covariance between two regression coefficients
# note that the variable names are parallel to what they are called in lm1 output
covFEveryDay <- varEstToCov(lm1$varEstInputs,
varA="dsexFemale",
varB="b017451Every day",
jkSumMultiplier=EdSurvey:::getAttributes(sdf, "jkSumMultiplier"))
# second, find the difference and the SE of the difference
se <- lm1$coefmat["dsexFemale","se"] + lm1$coefmat["b017451Every day","se"] +
-2*covFEveryDay
# third, calculate the t-statistic
tv <- (coef(lm1)["dsexFemale"] - coef(lm1)["b017451Every day"])/se
# fourth, calculate the p-value, which requires the estimated degrees of freedom
dofFEveryDay <- DoFCorrection(lm1$varEstInputs,
varA="dsexFemale",
varB="b017451Every day",
method="JR")
# finally, the p-value
2*(1-pt(abs(tv), df=dofFEveryDay))
## End(Not run)
```

[Package *EdSurvey* version 2.7.1 Index]