Computing unbiased variance estimators
Project description
Overview
This package contains the non-parametric unbiased estimators of the variance of teacher effects described in Rose, Schellenberg, and Shem-Tov (2022). These unbiased estimators are $U$-statistics, which provide minimum-variance unbiased estimators of population parameters for arbitrary probability distributions. The $U$-statistic approach overcomes several issues experienced by Empirical Bayes (EB) techniques when estimating an agent's 'value-added'. This readme is meant to be brief overview of how to install the package and how to use it -- the complete package documentation can be found here.
Authors
- Evan K. Rose (University of Chicago)
- Jonathan T. Schellenberg (Amazon Web Services)
- Yotam Shem-Tov (UCLA)
- Jack Mulqueeney (University of Chicago)
Installation
To install:
python3 -m pip install ustat_var
Usage
The package contains two functions that compute the non-parametric estimators presented in Appendix C of Rose, Schellenberg, and Shem-Tov (2022).
The first, ustat.varcovar estimates the variance-covariance, taking in two matrices as inputs:
import ustat_var as ustat
import numpy as np
# Seed and data
np.random.seed(18341)
X,Y = ustat.generate_test_data.generate_data(n_teachers = 10, n_time = 5, n_arrays = 2, var_fixed = 1, var_noise = 1.0, cov_factor = 0.5)
# Variance-covariance
ustat.varcovar(X, X) # Var(X)
ustat.varcovar(X, Y) # Cov(X, Y)
The second, ustat_samp_covar, estimates the sampling variance/covariance of varcovar. It takes four matrices as inputs, where ustat_samp_covar(A, B, C, D) yields $\hat{Cov}\big(\hat{Cov}(A,B) - Cov(A,B), \hat{Cov}(C,D) - Cov(C,D)\big)$. For example:
# Base implementation through ustat_samp_covar.ustat_samp_covar() functions:
ustat.ustat_samp_covar.ustat_samp_covar(X, X, X, X) # Sampling variance of Var(X)
ustat.ustat_samp_covar.ustat_samp_covar(X, Y, X, Y) # Sampling variance of Cov(X, Y)
# Faster implementation available in ustat_samp_covar.ustat_samp_covar_fast() function
ustat.ustat_samp_covar.ustat_samp_covar_fast(X, X, X, X) # Also computes sampling variance of Var(X), but faster than above
ustat.ustat_samp_covar.ustat_samp_covar_fast(X, Y, X, Y) # Also computes sampling variance of Cov(X, Y), but faster than above
You can find further details about each function in the package documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ustat_var-0.3.4.tar.gz.
File metadata
- Download URL: ustat_var-0.3.4.tar.gz
- Upload date:
- Size: 214.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a65ddda0889012b9447fe48834a514a82c8111013f6b356076323a3b4269443
|
|
| MD5 |
ed62b9be73e9c82f0fadd4a27837ff77
|
|
| BLAKE2b-256 |
95fc281f85d2531e84ab04d67cdf5026cd3fcc9b7f0735c43668d9bd7a30e336
|
File details
Details for the file ustat_var-0.3.4-py3-none-any.whl.
File metadata
- Download URL: ustat_var-0.3.4-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36a7d397f96cf618595f403171e6df8c68a3bc7c7f67cc5f9be279f1b15adfa5
|
|
| MD5 |
6de065ed08ba65288aa368ad77df47b9
|
|
| BLAKE2b-256 |
03236dcbdff4d30813b0ee30f634dad19a3476878e35e54a8e02e24a17a86a88
|