Skip to main content

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

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.

Metadata

Release files for ustat-var 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ustat-var 0.3.4
File Size Uploaded
ustat_var-0.3.4.tar.gz 214.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ustat-var 0.3.4
File Interpreter ABI Platform
ustat_var-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 228.9 kB

Release files / ustat_var-0.3.4.tar.gz

Download URL ustat_var-0.3.4.tar.gz
Size 214.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7a65ddda0889012b9447fe48834a514a82c8111013f6b356076323a3b4269443
BLAKE2b-256 checksum
How to use checksums
95fc281f85d2531e84ab04d67cdf5026cd3fcc9b7f0735c43668d9bd7a30e336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / ustat_var-0.3.4-py3-none-any.whl

Download URL ustat_var-0.3.4-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36a7d397f96cf618595f403171e6df8c68a3bc7c7f67cc5f9be279f1b15adfa5
BLAKE2b-256 checksum
How to use checksums
03236dcbdff4d30813b0ee30f634dad19a3476878e35e54a8e02e24a17a86a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page