learn_clustering_se

source

learn_clustering_se(n_clusters=40, cluster_size=30, icc=0.3, seed=0)

Show that clustering changes the standard error, not the point estimate.

Simulates data with cluster-correlated regressor and errors (intra-cluster correlation icc), then compares classical (iid) standard errors with cluster-robust ones for the same coefficient.

Parameters

Name Type Description Default
n_clusters int Number of clusters and observations per cluster. 40
cluster_size int Number of clusters and observations per cluster. 40
icc float Intra-cluster correlation of the errors (drives the standard-error inflation). 0.3
seed int Random seed. 0

Returns

Name Type Description
SandboxResult df (iid vs clustered standard error), fig, summary and topic.

Examples

This sandbox simulates its own clustered data, so the call needs no DataFrame:

import expdpy as ex

res = ex.learn_clustering_se()
res.fig