25  Matching

In Chapter 4, we discussed three basic causal diagrams and suggested that the concept of nonparametric conditioning on \(Z\) is more demanding than simply including \(Z\) as another regressor in a linear regression model. This chapter develops this idea more fully and examines practical approaches to properly conditioning on confounding variables.

Tip

The code in this chapter uses the packages listed below. For instructions on how to set up your computer to use this code, go to the support page for this book. The support page also includes Quarto templates for the code and exercises below.

import numpy as np
import polars as pl
import statspai as sp

from era_pl import load_parquet
from plotnine_polars import aes

25.1 Background on auditor choice

For concreteness, we will explore the basic ideas of this chapter using the setting of auditor choice and its effects. An extensive literature has examined the question of whether “Big N” auditors produce higher audit quality. This question is examined in two of the papers we will study in this chapter (DeFond et al., 2017; Lawrence et al., 2011).

For data on auditors, the table comp.funda has a column labelled au, which lines up with aucd in comp.r_auditors.

company = load_parquet("company", "comp")
funda = load_parquet("funda", "comp")
r_auditors = load_parquet("r_auditors", "comp")

When Lawrence et al. (2011) refer to the “Big Four”, they are actually referring to the current group that DeFond et al. (2017) refer to as the “Big N”. The latter term alludes to the prior incarnations of the set of top audit firms, including the “Big Five” (prior to the demise of Arthur Andersen) and the “Big Eight” (prior to mergers in the late 1980s) (see Gow and Kells, 2018 for more on this history).

r_auditors.sort("aucd").head(12).collect().style
Table 25.1: Values of aucd for top auditors
aucd audesc
0 Unaudited
1 Arthur Andersen
2 Arthur Young
3 Coopers & Lybrand
4 Ernst & Young
5 Deloitte & Touche
6 KPMG Peat Marwick
7 PricewaterhouseCoopers
8 Touche Ross
9 Other
10 Altschuler, Melvoin, and Glasser
11 BDO Seidman

Looking closer at a sample from r_auditors in Table 25.1, we see that Arthur Andersen has an aucd of 1. Note that Arthur Young is now part of Ernst & Young, Coopers & Lybrand is now part of PricewaterhouseCoopers, and Touche Ross is now part of Deloitte & Touche. So a reasonable approach to “Big N” would appear to be big4 = pl.col("aucd").is_between(1, 8).1 It’s commonly understood that most large firms choose a Big Four auditor. But rather than simply accepting that, we can look at the data.

Here we focus on firms with meaningful financial statements (sale > 0, at > 0) and fiscal 2019, the latest fiscal year with complete data at the time of first writing this chapter.

size_big4 = (
    funda
    .filter(
        pl.col("indfmt") == "INDL",
        pl.col("datafmt") == "STD",
        pl.col("consol") == "C",
        pl.col("popsrc") == "D",
        pl.col("sale") > 0,
        pl.col("at") > 0,
        pl.col("fyear") == 2019,
        pl.col("au").is_not_null()
    )
    .with_columns(
        au=pl.col("au").cast(pl.Int32),
        mkt_cap=pl.col("prcc_f") * pl.col("csho") * 1e6,
    )
    .with_columns(big4=pl.col("au").is_between(1, 8))
    .select("gvkey", "datadate", "fyear", "au", "big4", "mkt_cap")
    .sort("gvkey", "datadate")
)

We calculate market share by “bins” where each bin represents an order of magnitude of market capitalization and show statistics for each bin in Table 25.2. For example, (9, 10] includes all firms with market capitalization over $1 billion (\(10^9\)) and less than or equal to $10 billion (\(10^{10}\)).

(
    size_big4
    .filter(pl.col("mkt_cap") > 1e6)
    .with_columns(log_mkt_cap=pl.col("mkt_cap").log10())
    .with_columns(
        bin_id=pl.col("log_mkt_cap").floor(),
        bin=pl.col("log_mkt_cap").cut(np.arange(6, 14, 1), 
                   left_closed=False),
    )
    .group_by("bin_id", "bin")
    .agg(
        big4_perc=100 * pl.col("big4").cast(pl.Float64).mean(),
        big4_num=pl.col("big4").sum(),
        non_big4_num=(~pl.col("big4")).sum(),
    )
    .sort("bin_id")
    .drop("bin_id")
    .collect()
    .style
    .fmt_number(columns=["big4_perc"], decimals=2)
)
ipykernel/305866017.py:7: DeprecationWarning: `cut` is deprecated; use `bin_intervals` instead
Table 25.2: Big 4 market share by market capitalization
bin big4_perc big4_num non_big4_num
(6, 7] 16.32 63 323
(7, 8] 27.59 338 887
(8, 9] 58.06 1052 760
(9, 10] 89.68 1581 182
(10, 11] 96.76 687 23
(11, 12] 97.85 91 2
(12, 13] 100.00 1 0

Interestingly, one of the two cases of companies with an apparent market capitalization over $100 billion (\(10^{11}\)) and a non–Big Four auditor is Vanjia, which apparently misstated the number of its shares outstanding as 8,550 million rather than 30 million.2

(
    size_big4
    .filter(~pl.col("big4"),
            pl.col("mkt_cap") > 1e11)
    .collect()
    .style
    .fmt_number(columns=["mkt_cap"], decimals=0, use_seps=True)
)
Table 25.3: Two large non-Big 4 firms
gvkey datadate fyear au big4 mkt_cap
014447 2019-12-31 2019 9 False 234,168,146,856
026478 2019-12-31 2019 9 False 122,949,000,000

We can also present the data as a histogram. From either Table 25.2 or Figure 25.1, it is clear that the Big Four have overwhelming market share among the largest firms and have most of the market even among firms with market capitalization in the $100 million-to-$1 billion range.

(
    size_big4
    .filter(pl.col("mkt_cap") > 1e6)
    .with_columns(log_mkt_cap=pl.col("mkt_cap").log10())
    .collect()
    .ggplot(aes(x="log_mkt_cap", fill="big4"))
    .geom_histogram(breaks=np.arange(6, 12.25 + 0.25, 0.25))
)
Histogram of market capitalization showing that, as market capitalization increases, an increasing proportion of firms using Big Four auditor, with almost no firms with market capitalization over $10 billion using non-Big Four auditors.
Figure 25.1: Histogram of market capitalization with auditor type

25.2 Simulation analysis

One challenge for an empirical researcher studying the effect of having a Big Four auditor is that market capitalization is plausibly a confounding variable, or confounder, of the kind seen in Figure 4.1. That is, having a large market capitalization is likely to cause—or be associated with variables that cause—firms to choose a Big Four auditor and also to affect a variety of economic outcomes that may be of interest, such as accounting quality. We know from our analysis in Chapter 4 that we want to “control for” confounders but we show here that this is not always as simple as including the confounding variable in OLS regression.

In this section, we use simulation analysis to examine more closely how to control for confounding variables. We start with the actual empirical distribution of market capitalization from the data depicted in the histogram above. For each bin in the histogram depicted in Figure 25.1, we calculate the observed conditional probability of a firm in that bin having a Big Four auditor and store the results in prob_big4.

prob_big4 = (
    size_big4
    .filter(pl.col("mkt_cap") > 1e6)
    .select("big4", "mkt_cap")
    .with_columns(pl.col("mkt_cap").log10().name.prefix("log_"))
    .with_columns(
        bin=pl.col("log_mkt_cap").cut(
            np.arange(6.0, 12.25 + 0.25, 0.25),
            left_closed=False,
        )
    )
    .with_columns(
        p_big4=pl.col("big4").cast(pl.Float64).mean().over("bin")
    )
    .select("mkt_cap", "log_mkt_cap", "p_big4")
)
ipykernel/3440314612.py:7: DeprecationWarning: `cut` is deprecated; use `bin_intervals` instead

We then run our simulation. We draw 5,000 firms from this distribution and assign each firm an auditor based on the conditional probabilities calculated above. A critical assumption here is that, conditional on market capitalization, whether a Big Four auditor is chosen is completely random. Finally, we calculate a measure of audit quality that is a non-linear function of market capitalization and a random noise component.

n_firms = 5000
rng = np.random.default_rng(2021)

sim_auditor = (
    prob_big4
    .collect()
    .sample(n=n_firms, with_replacement=False, seed=2021)
    .with_row_index("id", offset=1)
    .with_columns(
        pl.Series("rand", rng.random(n_firms)),
        pl.Series("epsilon", rng.standard_normal(n_firms)),
    )
    .with_columns(
        big4=(pl.col("rand") < pl.col("p_big4")),
        audit_quality=(
            (pl.col("mkt_cap") ** (1 / 3)) * 0.003
            + pl.col("epsilon")
        ),
    )
    .select("id", "big4", "mkt_cap", "log_mkt_cap", "audit_quality")
)

Given this is a simulation, we know that the correct causal diagram is that shown in Figure 25.2.

Causal relationships between market capitalization (Z), having a Big Four auditor (X), and audit quality (Y) in the simulation. There are two arrows from Z, one to X and one to Y. The dashed line from X to Y denotes the absence of this causal relationship from the simulation, though our empirical analyses focus on this relationship.
Figure 25.2: Market capitalization is a confounder

We draw the arrow connecting \(X\) and \(Y\) with a dashed line because the true coefficient on big4 is zero, so in this simulation there is no actual causal relation between big4 and audit_quality. Of course, in reality, we would not know this fact and would need to infer it from data and a posited causal diagram.

The good news from this causal diagram is that correctly conditioning on \(Z\) should give us an unbiased estimator of the causal effect of \(X\) on \(Y\). So let’s regress audit_quality on big4 and mkt_cap.

fm = sp.feols(
    "audit_quality ~ big4 + I(mkt_cap / 1e9)",
    data=sim_auditor,
    vcov="iid",
)
sp.regtable(
    fm,
    model_labels=["OLS"],
    se_type="t",
    digits=3,
    star_levels=(0.10, 0.05, 0.01),
    stats=["N", "R2"],
    diagnostics=False,
)
Table 25.4: Regression of audit quality using simulated data
OLS
Intercept 1.538***
(29.457)
big4 2.289***
(34.762)
I(mkt_cap / 1000000000.0) 0.056***
(64.194)
N 5,000
R² 0.551
t-statistics in parentheses
*** p<0.01, ** p<0.05, * p<0.10

In Table 25.4, we see a clearly positive coefficient on big4 even though we are “controlling for” mkt_cap, and we might be tempted to conclude that we have identified a causal effect. Of course, we know that this conclusion is invalid. The issue is that we are effectively assuming a linear relation between mkt_cap and audit quality, whereas the true relation is non-linear in mkt_cap. As a result, “controlling for” mkt_cap by including mkt_cap in a regression does not adequately control for the relation between mkt_cap and audit quality. Because there is a non-linear relation between big4 and mkt_cap, the regression specification can use information in big4 to explain variation in audit_quality in addition to that variation explained by a linear function of mkt_cap. This additional explanatory power shows up as a statistically significant coefficient on big4 in the regression above.

Would some kind of matching analysis help?

Given its prominence in accounting research, we will focus on propensity-score matching here. In this section, we present propensity-score matching as a recipe of sorts. We then evaluate how well it does in our simulated settings before discussing some aspects of the theory that explains why (and when) we might expect it to work.

The first step in our recipe is the estimation of propensity scores, which are estimates of the probability of receiving treatment as a function of observed variables. The most common approach is to use logistic regression, which we fit here as a binomial GLM with the logit link (see Chapter 23).

sim_ps_data = sim_auditor.with_columns(
    treat=(~pl.col("big4")).cast(pl.Int8)
)

sim_fm = sp.glm(
    "treat ~ mkt_cap",
    data=sim_ps_data,
    family="binomial",
    link="logit",
)

We use fitted_values() to obtain the fitted probabilities on the original \([0, 1]\) scale.3

sim_match_pscores = sim_ps_data.with_columns(
    pl.Series("pscore", sim_fm.fitted_values())
)

The second step in the recipe is to match treatment observations to their nearest counterparts among the control observations, where “nearest” means closest in terms of propensity scores. But even with the propensity score, we need an algorithm. We use sp.match() to match each treated firm to one control firm without replacement, starting with the treated firm with the highest propensity score. As in Lawrence et al. (2011), the treatment is having a non–Big Four auditor, the less common condition. We use a caliper of 3 percentage points, so the predicted probabilities of the two firms in a pair can differ by at most 0.03. We keep observations with positive matching weights in sim_matches. Some treated firms have no available match within the caliper.

sim_match = sp.match(
    sim_match_pscores, y="audit_quality", treat="treat",
    covariates=["mkt_cap"], pscore="pscore",
    replace=False, n_matches=1, caliper=0.03, m_order="largest",
)
sim_matches = (
    pl.from_pandas(sim_match.matched_data)
    .filter(pl.col("_weight") > 0)
    .with_columns(subclass=pl.coalesce("_n1", "_id").cast(pl.Int64))
    .select(*sim_match_pscores.columns, "subclass")
)

Inspecting sim_matches, we see that it contains the variable pscore that exactly matches pscore that we estimated above.

(
    sim_match_pscores
    .join(sim_matches, on="id", how="inner")
    .with_columns(
        same_pscore = pl.col("pscore")==pl.col("pscore_right")
    )
    .group_by("same_pscore")
    .agg(pl.len())
)
shape: (1, 2)
same_pscore len
bool u32
true 2858

The subclass column identifies each pair using the control observation’s matching ID, which sp.match() reports in _n1 for the treated observation and _id for the control observation. Picking observations for three arbitrary values of subclass, we can see in Table 25.5 that each value is associated with a pair of observations, one with big4 == False and one with big4 == True and very similar values of mkt_cap and hence very similar pscore values.

(
    sim_matches
    .filter(pl.col("subclass").is_in([1612, 3231, 4713]))
    .select("subclass", "id", "big4", "mkt_cap", "pscore")
    .sort("subclass", "big4")
    .style
    .fmt_number(columns=["mkt_cap"], decimals=0)
    .fmt_number(columns=["pscore"], decimals=3)
)
Table 25.5: Sample matched pairs
subclass id big4 mkt_cap pscore
1612 2566 False 7,455,763 0.520
1612 1612 True 52,320,775 0.516
3231 4744 False 20,722,000 0.519
3231 3231 True 153,965,520 0.505
4713 918 False 12,885,600 0.520
4713 4713 True 88,694,100 0.512

To examine the success of the match, we can compare two pairs of histograms. The first pair of histograms (Figure 25.3) shows the propensity scores for all observations. Near the upper end of the score distribution, treatment observations outnumber control observations. These high propensity scores correspond to smaller firms, so there are relatively few small Big Four clients available to match with small non–Big Four clients. This suggests that many observations will be unmatched.

The second pair of histograms (Figure 25.4) shows the propensity scores for the matched observations. We can see that the distributions of p-scores for treatment and control observations look very similar, suggesting a fairly good match.

(
    sim_match_pscores
    .ggplot(aes(x="pscore", fill="big4"))
    .geom_histogram(binwidth=0.025)
    .facet_grid("big4 ~ .")
    .add_theme(legend_position="none")
)
Histograms of propensity scores in the full sample. Firms without Big Four auditors cluster at the upper end of the score distribution. Firms with Big Four auditors have a wider distribution, with many scores near zero.
Figure 25.3: Propensity scores distribution: All observations

(
    sim_matches
    .ggplot(aes(x="pscore", fill="big4"))
    .geom_histogram(binwidth=0.025)
    .facet_grid("big4 ~ .")
    .add_theme(legend_position="none")
)
Histograms of p-score using the matched sample for observations with and without Big Four auditors. Observations are clustered at the right end of the plot for both firms with Big Four auditors and those without.
Figure 25.4: Propensity scores distribution: Matched observations

If we are happy with the match, we can finish our analysis by estimating regressions. Like Lawrence et al. (2011), we estimate regressions with and without the variables from the p-score regression (Shipman et al., 2016 refer to these approaches as, respectively, “MR” and “t-test”).

fms = {
    "MR": sp.feols("audit_quality ~ big4", data=sim_matches, vcov="iid"),
    "MR + controls": sp.feols(
        "audit_quality ~ big4 + I(mkt_cap / 1e9)",
        data=sim_matches,
        vcov="iid",
    ),
}
sp.regtable(
    *fms.values(),
    model_labels=list(fms),
    se_type="t",
    digits=3,
    star_levels=(0.10, 0.05, 0.01),
    stats=["N", "R2"],
    diagnostics=False,
)
Table 25.6: Relation between big4 and audit quality (matched)
MR MR + controls
Intercept 1.595*** 1.468***
(37.342) (39.971)
big4 0.525*** 0.501***
(8.694) (9.704)
I(mkt_cap / 1000000000.0) 0.163***
(32.426)
N 2,858 2,858
R² 0.026 0.288
t-statistics in parentheses
*** p<0.01, ** p<0.05, * p<0.10

Interestingly, in Table 25.6, we see that big4 still has a statistically significant relation with audit quality. This is likely due to a residual effect of mkt_cap being picked up by big4 due to the imperfection of the propensity-score match.

25.2.1 Exercises

  1. What happens in the above analyses if the true effect of big4 on audit quality is 10 instead of 0?

  2. What happens in the above analyses if the caliper is reduced to 0.01 from 0.03 (but the true effect of big4 on audit quality is still 0)?

  3. What happens in the above analyses if the caliper is reduced to 0.01 from 0.03 and the true effect of big4 on audit quality is 10?

  4. Given the above, what are your conclusions about the value of propensity-score matching and OLS in causal inference?

  5. What regression results do you get if you repeat the analysis shown in Table 25.4, but replace I(mkt_cap / 1e+09) with I(mkt_cap ** (1/3) * 0.003)? Does this suggest a solution to the issues we see above? If so, what challenges does such a solution face?

  6. Was endogeneity an issue in the simulation above? If not, why not? If so, in what way, and what could you do to address it?

25.3 Replication of Lawrence et al. (2011)

To facilitate discussion, we conduct an approximate replication of Lawrence et al. (2011) and begin by constructing a subset of Compustat with calculations used in that paper.

comp = (
    funda
    .filter(
        pl.col("indfmt") == "INDL",
        pl.col("datafmt") == "STD",
        pl.col("consol") == "C",
        pl.col("popsrc") == "D",
    )
    .select(
        "gvkey", "datadate", "fyear", "au", "prcc_f",
        "csho", "at", "ib", "dltt", "dlc", "rect", "ppent", 
        "sale", "act", "lct", "sich", "oancf", "ceq",
    )
    .filter(pl.col("fyear").is_between(1986, 2006))
    .sort("gvkey", "fyear")
    .with_columns(sic2=pl.col("sich").floordiv(100))
    .with_columns(curr=pl.col("act").era.div_if_pos("lct"))
    .with_columns(
        pl.col("fyear", "at", "sale", "rect", "curr")
        .shift(1)
        .over("gvkey")
        .name.prefix("lag_")
    )
    .with_columns(
        avg_at=(pl.col("lag_at") + pl.col("at")) / 2,
        d_sale=pl.col("sale") - pl.col("lag_sale"),
        d_rect=pl.col("rect") - pl.col("lag_rect"),
        accruals=pl.col("ib") - pl.col("oancf"),
        mkt_cap=pl.col("prcc_f") * pl.col("csho"),
    )
    .with_columns(
        log_at=pl.col("at").log(),
        aturn=pl.col("sale").era.div_if_pos("lag_at"),
        inv_avg_at=(
            pl.when(pl.col("avg_at") != 0)
            .then(1 / pl.col("avg_at"))
            .otherwise(None)
        ),
        d_sale_at=(
            (pl.col("d_sale") - pl.col("d_rect"))
            .era.div_if_pos("avg_at")
        ),
        ppe_at=(
            pl.col("ppent").era.div_if_pos("avg_at")
        ),
        lev=(pl.col("dltt") + pl.col("dlc").fill_null(0))
            .era.div_if_pos("avg_at"),
        roa=pl.col("ib").era.div_if_pos("avg_at"),
        ta=pl.col("accruals").era.div_if_pos("avg_at"),
        log_mkt=(
            pl.when(pl.col("mkt_cap") > 0)
            .then(pl.col("mkt_cap").log())
        ),
    )
    .with_columns(
        pl.col("lev", "roa")
        .shift(1)
        .over("gvkey")
        .name.prefix("lag_")
    )
    .filter(
        pl.col("sich").is_not_null(),
        ~pl.col("sich").is_between(6000, 6999),
        pl.col("sale") > 0,
        pl.col("at") > 0,
        (pl.col("dltt") >= 0) | pl.col("dltt").is_null(),
        (pl.col("dlc") >= 0) | pl.col("dlc").is_null(),
        pl.col("prcc_f") * pl.col("csho") > 0,
        pl.col("ceq") > 0,
        pl.col("fyear").is_between(1988, 2006),
        pl.col("au").cast(pl.Int32, strict=False).is_not_null(),
    )
    .filter(pl.col("lag_fyear") == (pl.col("fyear") - 1))
)

Lawrence et al. (2011) estimate discretionary accrual models by industry and year, subject to a requirement of at least 10 data points for each model. So we compile a list of industry-years that meet this criterion.

industries = (
    comp
    .group_by("fyear", "sic2")
    .agg(n_firms=pl.len())
    .filter(pl.col("n_firms") >= 10)
    .select("fyear", "sic2")
    .collect()
)

We next construct a function to estimate discretionary accruals along the lines described in footnote 11 of Lawrence et al. (2011). Because we self-join the results data frame created in this function in a way that results in multiple matches for each observation, we specify relationship = "many-to-many".

def get_klw_data(sic2: int, fyear: int) -> pl.DataFrame:
    reg_data = (
        comp
        .filter(pl.col("sic2") == sic2,
                pl.col("fyear") == fyear)
        .select(
            "gvkey", "fyear", "roa", "ta",
            "inv_avg_at", "d_sale_at", "ppe_at"
        )
        .filter(
            pl.all_horizontal(
                pl.col("roa", "ta", "inv_avg_at", "d_sale_at", "ppe_at")
                .is_finite()
            )
        )
        .collect()
    )

    if reg_data.height < 10:
        return reg_data.select("gvkey", "fyear").head(0).with_columns(
            pl.lit(None, dtype=pl.Float64).alias("da"),
            pl.lit(None, dtype=pl.Float64).alias("ada"),
        )

    x = np.column_stack(
        [
            np.ones(reg_data.height),
            reg_data["inv_avg_at"],
            reg_data["d_sale_at"],
            reg_data["ppe_at"],
        ]
    )
    y = reg_data["ta"]
    try:
        beta, *_ = np.linalg.lstsq(x, y, rcond=None)
    except np.linalg.LinAlgError:
        return reg_data.select("gvkey", "fyear").head(0).with_columns(
            pl.lit(None, dtype=pl.Float64).alias("da"),
            pl.lit(None, dtype=pl.Float64).alias("ada"),
        )

    results = (
        reg_data
        .select("gvkey", "fyear", "roa").with_columns(
            da=pl.Series(name="da", values=(y - x @ beta))
        )
    )

    pairs = (
        results
        .join(
            results.rename(
                {
                    "gvkey": "gvkey_match",
                    "roa": "roa_match",
                    "da": "da_match",
                }
            ),
            on="fyear",
            how="inner",
        )
        .filter(pl.col("gvkey") != pl.col("gvkey_match"))
    )
    if pairs.height == 0:
        return reg_data.select("gvkey", "fyear").head(0).with_columns(
            pl.lit(None, dtype=pl.Float64).alias("da"),
            pl.lit(None, dtype=pl.Float64).alias("ada"),
        )

    return (
        pairs
        .with_columns(
            roa_diff=(pl.col("roa") - pl.col("roa_match")).abs()
        )
        .sort("gvkey", "fyear", "roa_diff", "gvkey_match")
        .group_by("gvkey", "fyear")
        .first()
        .with_columns(
            ada=(pl.col("da") - pl.col("da_match")).abs()
        )
        .select("gvkey", "fyear", "da", "ada")
    )

We can then apply this function to industries, our set of industry-years, and store the results in klw_results.4

klw_results = pl.concat(
    [
        get_klw_data(**row)
        for row in industries.iter_rows(named=True)
    ],
    how="vertical",
)

We first estimate an OLS regression using the full sample and raw (i.e., unwinsorized) data and store it in a dictionary named fms.

full_sample = (
    comp
    .collect()
    .join(klw_results, on=["gvkey", "fyear"], how="inner")
    .filter(pl.col("avg_at") > 0)
    .with_columns(
        big4=pl.col("au").cast(pl.Int32).is_between(1, 8),
        mkt_cap=pl.col("prcc_f") * pl.col("csho"),
        log_mkt=(
            pl.when(pl.col("mkt_cap") > 0)
            .then(pl.col("mkt_cap").log())
        ),
    )
)

formula_klw = (
    "ada ~ big4 + log_mkt + lag_roa + lag_lev + lag_curr "
    "| sic2 + fyear"
)

fms = {
    "OLS": sp.feols(
        formula_klw,
        data=full_sample.with_columns(pl.col("big4").cast(pl.Int8)),
        vcov={"CRV1": "gvkey"},
    )
}
statspai/output/_lineage.py:642: AssumptionWarning: feols: 7857 of 99921 rows dropped for missing values (listwise deletion) -- by column: {'lag_roa': 5464, 'lag_lev': 5619, 'lag_curr': 2374}.

Lawrence et al. (2011) winsorize several variables in their analysis. We use the .era.winsorize() method from the era_pl expression namespace to do this here.5 We then fit a model using the winsorized data and store it in fms.

win_vars = [
    "ada", "log_mkt", "lag_roa", "lag_lev", "lag_curr",
    "roa", "lev", "curr", "mkt_cap"
]

full_sample_win = (
    full_sample
    .with_columns(pl.col(win_vars).era.winsorize(),
                  pl.col("big4").cast(pl.Int8))
)

fms["OLS, win"] = sp.feols(formula_klw, data=full_sample_win, vcov={"CRV1": "gvkey"})
statspai/output/_lineage.py:642: AssumptionWarning: feols: 7857 of 99921 rows dropped for missing values (listwise deletion) -- by column: {'lag_roa': 5464, 'lag_lev': 5619, 'lag_curr': 2374}.

We next construct matched samples using propensity-score matching. Following Lawrence et al. (2011), we use a caliper of 3 percentage points and match without replacement. We pass the fitted propensity scores to sp.match() and use m_order="data" to consider treated observations in the seeded order. A treated observation enters the matched regression sample only if an unused control is within the caliper when its turn comes. First, we match using the raw data and estimate a model using this matched sample.

def psm_match(df: pl.DataFrame, caliper: float = 0.03) -> pl.DataFrame:
    match_covars = ["log_at", "log_mkt", "aturn", "curr", "lev", "roa"]
    reg_vars = ["ada", "big4", "log_mkt", "lag_roa",
                "lag_lev", "lag_curr", "sic2", "fyear"]

    covars = match_covars + reg_vars

    d = (
        df
        .filter(pl.all_horizontal(pl.col(covars).is_not_null()))
        .with_columns(
            big4=pl.col("big4").cast(pl.Int8),
            treat=(pl.col("big4").cast(pl.Int8) == 0).cast(pl.Int8),
        )
    )

    ps_fm = sp.glm(
        "treat ~ log_at + log_mkt + aturn + curr + lev + roa",
        data=d.select("treat", *match_covars),
        family="binomial",
        link="logit",
        tol=1e-12,
    )

    d = d.with_columns(
        pscore=pl.Series("pscore", ps_fm.fitted_values())
    )

    treatment = d["treat"].to_numpy()
    rng = np.random.RandomState(2021)
    treated = rng.permutation(np.flatnonzero(treatment == 1))
    controls = np.flatnonzero(treatment == 0)

    match_data = d.select("ada", "treat", "pscore", *match_covars).with_row_index("match_row")
    match = sp.match(
        match_data[np.concatenate((treated, controls))],
        y="ada", treat="treat", covariates=match_covars, pscore="pscore",
        replace=False, n_matches=1, caliper=caliper, m_order="data",
    )
    matched_rows = (
        pl.from_pandas(match.matched_data)
        .filter(pl.col("_weight") > 0)
        .get_column("match_row")
    )
    return d[matched_rows]

lmz_matched = psm_match(full_sample, caliper=0.03)
fms["PSM"] = sp.feols(formula_klw, data=lmz_matched, vcov={"CRV1": "gvkey"})
statspai/regression/glm.py:1037: StatsPAIWarning: 4 fitted probabilities are numerically 0 or 1, but the data are not separated (no linear combination of the regressors splits the two outcomes; checked by linear programming), so the maximum-likelihood estimates exist and the fit is a finite optimum. Those observations lie far out in the regressor space; their probabilities are reported as computed rather than floored.
statspai/core/_covariates.py:228: UserWarning: PSM can increase imbalance and bias (King & Nielsen 2019). Consider distance='mahalanobis' or method='cem'.
statspai/matching/match.py:826: UserWarning: sp.match: 1651 of 16845 on-support treated units found no match at all and are EXCLUDED from the reported ATT (10% of the treated sample). Cause: the caliper or common-support rule left those treated units without an admissible donor. Widen the caliper, or accept the restricted estimand. The reported effect is an ATT over the matched subset, which is selected non-randomly.

Second, we match using the winsorized data and estimate a model using the matched sample.

lmz_matched_win = psm_match(full_sample_win, caliper=0.03)
fms["PSM, win"] = sp.feols(formula_klw, data=lmz_matched_win, vcov={"CRV1": "gvkey"})
statspai/regression/glm.py:1037: StatsPAIWarning: 4 fitted probabilities are numerically 0 or 1, but the data are not separated (no linear combination of the regressors splits the two outcomes; checked by linear programming), so the maximum-likelihood estimates exist and the fit is a finite optimum. Those observations lie far out in the regressor space; their probabilities are reported as computed rather than floored.
statspai/core/_covariates.py:228: UserWarning: PSM can increase imbalance and bias (King & Nielsen 2019). Consider distance='mahalanobis' or method='cem'.
statspai/matching/match.py:826: UserWarning: sp.match: 1670 of 16845 on-support treated units found no match at all and are EXCLUDED from the reported ATT (10% of the treated sample). Cause: the caliper or common-support rule left those treated units without an admissible donor. Widen the caliper, or accept the restricted estimand. The reported effect is an ATT over the matched subset, which is selected non-randomly.

Regression results from all four models are shown in Table 25.7. These multivariate regressions cluster standard errors by firm, following the note to Table 2 of Lawrence et al. (2011). The sample and proxy specification remain an approximate replication rather than an exact reproduction of the published estimates.

table = sp.regtable(
    *fms.values(),
    model_labels=list(fms),
    se_type="t",
    digits=3,
    star_levels=(0.10, 0.05, 0.01),
    stats=["N", "R2"],
    diagnostics=False,
    consistency_check=False,
    add_rows={"fyear FE": ["Yes"] * len(fms), "sic2 FE": ["Yes"] * len(fms)},
    notes=[
        "The OLS columns use the full regression sample and the PSM columns use the matched samples."
    ],
)
table
Table 25.7: Relation between Big 4 and absolute value of discretionary accruals
OLS OLS, win PSM PSM, win
big4 -0.031*** -0.017*** -0.006** -0.005***
(-10.024) (-11.571) (-2.105) (-2.788)
log_mkt -0.011*** -0.006*** -0.008*** -0.006***
(-27.922) (-23.109) (-8.210) (-11.735)
lag_roa -0.002** -0.137*** -0.094*** -0.149***
(-1.986) (-44.807) (-5.662) (-35.133)
lag_lev -0.000 -0.031*** -0.011* -0.029***
(-0.323) (-12.197) (-1.677) (-5.965)
lag_curr -0.000** -0.001*** -0.000* -0.000
(-2.336) (-3.681) (-1.845) (-0.549)
fyear FE Yes Yes Yes Yes
sic2 FE Yes Yes Yes Yes
N 92,064 92,064 30,388 30,350
R² 0.058 0.166 0.086 0.154
t-statistics in parentheses
*** p<0.01, ** p<0.05, * p<0.10
The OLS columns use the full regression sample and the PSM columns use the matched samples.

In Table 25.7, the Big Four coefficient is negative in all four specifications. In the matched sample it is significant at the 5% level without winsorization and at the 1% level with winsorization. The strength of the statistical evidence therefore depends on the specification, although both matched estimates remain statistically significant in this Python analysis.

25.4 DeFond et al. (2017)

DeFond et al. (2017) re-examine the question of Lawrence et al. (2011), but with some differences in approach.

The first set of differences relates to design choices in the application of propensity-score matching. While Lawrence et al. (2011) focus on a single propensity-score model with five primary covariates, DeFond et al. (2017) augment the propensity-score model with twenty additional variables, namely the squares and cubes of these covariates and the ten interactions between the five covariates. DeFond et al. (2017) then select 1,500 random subsets from the twenty variables to develop propensity-score models. For each estimated propensity-score model, the caliper is set at a random value (less than 30%) that yields a “balanced matched sample”.

A second design-choice variation that DeFond et al. (2017) consider is matching with replacement. While Lawrence et al. (2011) focus on matching one treatment observation with (at most) one control observation without replacement (i.e., once a control observation is matched to a treatment observation, it is not available to match with another treatment observation), DeFond et al. (2017) consider matches with replacement and consider matches where each treatment observation is matched to one, two, or three control firms.

The second set of differences between DeFond et al. (2017) and Lawrence et al. (2011) relates to the measures of audit quality considered. Lawrence et al. (2011) consider cost of equity capital and analyst forecast accuracy, while DeFond et al. (2017) omit these two measures on the basis that they have “poor construct validity, and as a result are rarely used in the prior literature” (DeFond et al., 2017, p. 3637). Instead, DeFond et al. (2017) consider three other measures of audit quality: income-increasing discretionary accruals, restatements, and going concern opinions.

25.5 Further reading

The goal of this chapter was to provide a quick introduction to matching and show what matching can and cannot do. Perhaps the most important takeaway is that matching is not a panacea for issues arising due to endogenous selection into treatment based on unobservable variables (Shipman et al., 2016).

Cunningham (2021) provides a good introduction to matching with discussion of inverse probability weighting and coarsened exact matching. Guo et al. (2020) provide a book-length treatment of the topic.

We saw in Section 25.2 that, even when selection into treatment is based on observable variables, estimates can be unreliable. Chapter 14 of Huntington-Klein (2021) discusses a number of approaches that can be used to address such cases, including inverse probability weighted regression adjustment and entropy balancing.

25.6 Discussion questions

  1. Given the evidence presented in the simulation, how do you interpret the regression results presented in Table 25.7? How do DeFond et al. (2017) appear to interpret the results?

  2. Referring back to the basic causal relations described in Section 4.2, what is the causal diagram implied by equation (1) and Table 2 of Lawrence et al. (2011)? What variables are in PROXY_CONTROLS for Table 2? Why is LOG_ASSETS not found in Table 2?

  3. Do Lawrence et al. (2011) report results from estimating equation (1)? What happens to the “difference in means” between the Full Sample and the Propensity-Score Matched Sample in Table 1? Does this make sense?

  4. Why do you think the difference in means is still statistically significant for two variables in the Propensity-Score Matched Sample column of Table 1 in Lawrence et al. (2011)? Do you think this is a concern?

  5. Lawrence et al. (2011) evaluate three outcomes as measures of audit quality: discretionary accruals, cost of equity, and analyst forecast accuracy? Evaluate each of these measures. Which do you think is best? What are the strengths and weaknesses of this best measure?

  6. Can you think of other measures of audit quality that might make sense?

  7. Apply the check list of Shipman et al. (2016, pp. 217–218) and the questions in Panels B and C of Table 1 of Shipman et al. (2016) to Lawrence et al. (2011). How do Lawrence et al. (2011) stack up against these?


  1. This appears to be the approach used in DeFond et al. (2017), but whether this lines up with the approach used in Lawrence et al. (2011) is hard to say.↩︎

  2. The higher number can be seen in Vanjia’s 10-Q filing for Q1 2020 (https://go.unimelb.edu.au/rzw8), but appears to have been quietly corrected in Vanjia’s 10-Q filing for Q2 2020 (https://go.unimelb.edu.au/jzw8). The other company is LVMH, the French luxury goods firm, which appears to have been audited in part by Ernst & Young: https://go.unimelb.edu.au/izw8.↩︎

  3. StatsPAI may report probabilities numerically equal to 0 or 1 without the data being separated. These probabilities are reported as computed rather than clipped away from the boundary.↩︎

  4. Here KLW refers to Kothari et al. (2005).↩︎

  5. We discuss winsorization in Chapter 24.↩︎