Skip to main content

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ustat_var-0.3.3.tar.gz (213.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ustat_var-0.3.3-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file ustat_var-0.3.3.tar.gz.

File metadata

  • Download URL: ustat_var-0.3.3.tar.gz
  • Upload date:
  • Size: 213.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for ustat_var-0.3.3.tar.gz
Algorithm Hash digest
SHA256 f029afed53965167ecd253dabb49a0b1ec09b0aef829a820eedb417df00b72c3
MD5 31ad525e698347823e4ef6db66cd296c
BLAKE2b-256 1897ff2c2d41306cd317d7966a727f5a5307c2e8dba051e4bf03f0ebf76d7a37

See more details on using hashes here.

File details

Details for the file ustat_var-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: ustat_var-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for ustat_var-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c07853bdb3fa57d120e2f52cc2284c10087907694c2c1ff593f6ab26b786e5
MD5 4af5fc60ccfd48c2534a151af785a4d7
BLAKE2b-256 9b5ce6dc2f64b1ec35c086c0433b6da7c9a1a685203235aed6687acd1aef691d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page