# Can cross validation be used for causal inference?

In all contexts I am familiar with cross-validation it is solely used with the goal of increasing predictive accuracy. Can the logic of cross validation be extended in estimating the unbiased relationships between variables?

While this paper by Richard Berk demonstrates the use of a hold out sample for parameter selection in the "final" regression model (and demonstrates why step-wise parameter selection is not a good idea), I still don't see how that exactly ensures unbiased estimates of the effect X has on Y any more so than choosing a model based on logic and prior knowledge of the subject.

I ask that people cite examples in which one used a hold-out sample to aid in causal inference, or general essays that may help my understanding. I also don't doubt my conception of cross validation is naive, and so if it is say so. It seems offhand the use of a hold out sample would be amenable to causal inference, but I do not know of any work that does this or how they would do this.

Citation for the Berk Paper:

Statistical Inference After Model Selection by: Richard Berk, Lawrence Brown, Linda Zhao Journal of Quantitative Criminology, Vol. 26, No. 2. (1 June 2010), pp. 217-236.

This question on exploratory data analysis in small sample studies by chl prompted this question.

I think it's useful to review what we know about cross-validation. Statistical results around CV fall into two classes: efficiency and consistency.

Efficiency is what we're usually concerned with when building predictive models. The idea is that we use CV to determine a model with asymtptotic guarantees concerning the loss function. The most famous result here is due to Stone 1977 and shows that LOO CV is asymptotically equivalent to AIC. But, Brett provides a good example where you can find a predictive model which doesn't inform you on the causal mechanism.

Consistency is what we're concerned with if our goal is to find the "true" model. The idea is that we use CV to determine a model with asymptotic guarantees that, given that our model space includes the true model, we'll discover it with a large enough sample. The most famous result here is due to Shao 1993 concerning linear models, but as he states in his abstract, his "shocking discovery" is opposite of the result for LOO. For linear models, you can achieve consistency using LKO CV as long as $k/n \rightarrow 1$ as $n \rightarrow \infty$. Beyond linear mdoels, it's harder to derive statistical results.

But suppose you can meet the consistency criteria and your CV procedure leads to the true model: $Y = \beta X + e$. What have we learned about the causal mechanism? We simply know that there's a well defined correlation between $Y$ and $X$, which doesn't say much about causal claims. From a traditional perspective, you need to bring in experimental design with the mechanism of control/manipulation to make causal claims. From the perspective of Judea Pearl's framework, you can bake causal assumptions into a structural model and use the probability based calculus of counterfactuals to derive some claims, but you'll need to satisfy certain properties.

Perhaps you could say that CV can help with causal inference by identifying the true model (provided you can satisfy consistency criteria!). But it only gets you so far; CV by itself isn't doing any of the work in either framework of causal inference.

If you're interested further in what we can say with cross-validation, I would recommend Shao 1997 over the widely cited 1993 paper:

You can skim through the major results, but it's interesting to read the discussion that follows. I thought the comments by Rao & Tibshirani, and by Stone, were particularly insightful. But note that while they discuss consistency, no claims are ever made regarding causality.

• Thank you for all the references, especially the Judea Pearl responses (I will need to buy the book based on all the wonderful info in those short response essays.) – Andy W Nov 8 '10 at 21:09
• Comments for downvote are always welcome! – chl Feb 6 '11 at 11:08

This is a really interesting question and I don't offer any specific citations. However, in general, I'd say, NO, in and of itself, cross-validation does not offer any insight into causality. In absence of a designed experiment, the issue of causality is always uncertain. As you suggest, cross-validation can and will improve predictive accuracy. This, alone, says nothing about causality.

Absent of a designed experiment, causal inference would require a model that includes all of the relevant predictors--something that we can rarely guarantee in an observational study. Moreover, a simple lag variable, for example (or anything highly correlated with whatever outcome we were trying to predict) would produce a good model and one which could be validated in multiple samples. That does not mean, however, that we can infer causation. Cross-validation assures repeatability in predictions and nothing more. Causality is a matter of design and logic.

EDIT: Here's an example to illustrate. I could build a model with good predictive accuracy that predicts the population of a city based on the amount of money the city spends on trash removal. I could use cross-validation to test the accuracy of that model as well as other methods to improve the accuracy of prediction and get more stable parameters. Now, while this model works great for prediction, the causal logic is wrong--the causal direction is reversed. No matter what the folks in the Public Works Department might argue, increasing their budget for trash removal would not be a good strategy to increase the city's population (the causal interpretation).

The issues of accuracy and repeatability of a model are separate from our ability to make causal inferences about the relationships we observe. Cross-validation helps us with the former and not with the latter. Now, IF we are estimating a "correct" model in terms of specifying a casual relationship (for example, trying to determine what our trash removal budget should be based on our expected population next year), cross-validation can help us to have greater confidence in our estimate of that effect. However, cross-validation does nothing to help us choose the "correct" model with regard to causal relationships. Again, here we need to rely on the design of the study, our subject matter expertise, theory, and logic.

• So you don't think repeatability in effect estimates can be useful? Although you are not alone in your conception of what proof of causality is , I think it is quite narrow. We will never be able to indefinately prove a causal relationship, even with an experiment, absent all the evidence in the universe. Hence in my opinion the goal is to proffer evidence that whatever relationship we estimate is as close to the truth given the information we do know. Given that don't you think repeatability in prediction from a training set to a hold out sample could be a useful check on inferences made? – Andy W Oct 24 '10 at 5:48
• I appreciate your comments as well, and I completely agree that inferences are heavily dependent on logic and the research design. – Andy W Oct 24 '10 at 5:50
• Andy, I've edited my post to address your comments. Also, I don't mean to suggest that causal inference cannot be done outside of the context of a designed experiment. Nonetheless, it is more difficult and less certain in observational studies and we shouldn't look to model building procedures to help us with that problem. Rather, we should try to better understand the problems for which we are attempting to understand causal relationships. – Brett Oct 24 '10 at 14:53
• I agree with pretty much everything you say, except that issues of accuracy and repeatability are essential to make correct inferences in the face of doubt. I can give experts the benefit of the doubt that they are building logical models. Where I am concerned is repeatability of the findings in many observational contexts. Although I agree repeatability does not necessarily account for confounding influences that are best dealt with in experimental settings. – Andy W Oct 25 '10 at 15:11

It seems to me that your question more generally addresses different flavour of validation for a predictive model: Cross-validation has somewhat more to do with internal validity, or at least the initial modelling stage, whereas drawing causal links on a wider population is more related to external validity. By that (and as an update following @Brett's nice remark), I mean that we usually build a model on a working sample, assuming an hypothetical conceptual model (i.e. we specify the relationships between predictors and the outcome(s) of interest), and we try to obtain reliable estimates with a minimal classification error rate or a minimal prediction error. Hopefully, the better the model performs, the better it will allow us to predict outcome(s) on unseen data; still, CV doesn't tell anything about the "validity" or adequacy of the hypothesized causal links. We could certainly achieve decent results with a model where some moderation and/or mediation effects are neglected or simply not known in advance.

My point is that whatever the method you use to validate your model (and holdout method is certainly not the best one, but still it is widely used in epidemiological study to alleviate the problems arising from stepwise model building), you work with the same sample (which we assume is representative of a larger population). On the contrary, generalizing the results and the causal links inferred this way to new samples or a plausibly related population is usually done by replication studies. This ensures that we can safely test the predictive ability of our model in a "superpopulation" which features a larger range of individual variations and may exhibit other potential factors of interest.

Your model might provide valid predictions for your working sample, and it includes all potential confounders you may have think of; however, it is possible that it will not perform as well with new data, just because other factors appear in the intervening causal path that were not identified when building the initial model. This may happen if some of the predictors and the causal links inferred therefrom depend on the particular trial centre where patients were recruited, for example.

In genetic epidemiology, many genome-wide association studies fail to replicate just because we are trying to model complex diseases with an oversimplified view on causal relationships between DNA markers and the observed phenotype, while it is very likely that gene-gene (epistasis), gene-diseases (pleiotropy), gene-environment, and population substructure all come into play, but see for example Validating, augmenting and refining genome-wide association signals (Ioannidis et al., Nature Reviews Genetics, 2009 10). So, we can build-up a performant model to account for the observed cross-variations between a set of genetic markers (with very low and sparse effect size) and a multivariate pattern of observed phenotypes (e.g., volume of white/gray matter or localized activities in the brain as observed through fMRI, responses to neuropsychological assessment or personality inventory), still it won't perform as expected on an independent sample.

As for a general reference on this topic, can recommend chapter 17 and Part III of Clinical Prediction Models, from EW Steyerberg (Springer, 2009). I also like the following article from Ioannidis:

Ioannidis, JPA, Why Most Published Research Findings Are False? PLoS Med. 2005 2(8): e124

• @chl: Can you explain your statement in the first paragraph on internal v. external validity? In the tradition that I am familiar with: internal validity refers to the ability to assert cause and effect relationships among the variables within the particular sample; external validity is about the ability to generalize from a sample to other persons, places, and times. Traditionally, cross-validation is about the latter and thus by the above definition about external validity, whereas you state that it is about internal validity. Did I misunderstand your statement? – Brett Oct 26 '10 at 15:08
• @Brett I was thinking of CV as a statistical technique to avoid overfitting or to provide a measure of prediction accuracy on the working sample (hence not necessiraly as a dedicated tool to demonstrate internal validity). I was not very clear, thanks or pointing that. I agree that this is then used to generalize over the sample at hand, but there I think it has nothing to do with causal inference (CV doesn't prove anything about causal links as modelled on the working sample). I share your view on external validity, but to demonstrate it we need other samples, no? – chl Oct 26 '10 at 15:21
• You might clarify that first paragraph. I think you're trying to say that CV doesn't do internal validity. That's a matter for other processes. But, if we've got good internal validity for other reasons, whatever that might be, CV will help estimate that effect more accurately across persons, places, and times--i.e. improve external validity. I still cannot think of any way that CV would help us to make causal claims about relationships between variables--the internal validity question itself--only to help generalize an established causal relationship. – Brett Oct 26 '10 at 15:28
• @Brett I think your comments to this question are very pertinent and sum up some of the issues very nicely. I doubt it will help any of the confusion between internal and external validity at this point, but chl's genetic epidemiology example is actually a problem of internal validity not external validity (except for between dataset heterogeneity (or population substructure), but that IMO is of less concern than internal validity in these examples). – Andy W Oct 26 '10 at 16:52
• Brett's definition between internal and external validity is accurate, but for our purposes it will help to define it in different terms. External validity is only concerned with the sample and how that sample relates to other populations. Internal validity is concerned with various aspects about the effects estimated and the constructs used to estimate those effects. – Andy W Oct 26 '10 at 20:06

This is a good question, but the answer is definitely no: cross-validation will not improve causal inference. If you have a mapping between symptoms and diseases, cross-validation will help to insure that your model matches their joint distribution better than if you had simply fit your model to the entire raw data set, but it can't ever tell you anything about the directionality of causation.

Cross-validation is very important and worth studying, but it does nothing more than prevent you from overfitting to noise in your data set. If you'd like to understand it more, I'd suggest Chapter 7 of ESL: http://www-stat.stanford.edu/~hastie/Papers/ESLII.pdf

• Thank you for the reference. So say you are not concerned about model selection, could cross validating the effect estimates of the training data set to the hold out dataset be useful? – Andy W Oct 24 '10 at 5:54
• It could be, but I'd say that you're basically doing bootstrapping (or some variation thereof) at that point. – John Myles White Oct 25 '10 at 1:46
• I agree, I and think there are other things regularly done that reflect this same sort of logic (such as subset specificity tests or non-equivalent dependent variables). I simply posed the question because I imagined more formal treatments existed. – Andy W Oct 25 '10 at 15:06
• Comments for downvote are always welcome! – chl Feb 6 '11 at 11:14
• This book is the gift that keeps on giving! – hayd Nov 4 '14 at 3:02

To respond to the follow-up @Andy posted as an answer here...

Although I could not say which estimate is correct and which is false, doesn't the inconsistency in the Assault Conviction and the Gun conviction estimates between the two models cast doubt that either has a true causal effect on sentence length?

I think what you mean is the discrepancy in the parameter estimates gives us reason to believe that neither parameter estimate represents the true causal effect. I agree with that, though we already had plenty of reason to be skeptical that such a model would render the true causal effect.

Here's my take: Over-fitting data is a source of biased parameter estimates, and with no reason to believe that this bias offsets other sources of bias in estimating a particular causal effect, it must then be better, on average, to estimate causal effects without over-fitting the data. Cross-validation prevents over-fitting, thus it should, on average, improve estimates of causal effects.

But if someone is trying to convince me to believe their estimate of a causal effect from observational data, proving that they haven't over-fit their data is a low-priority unless I have strong reason to suspect their modelling strategy is likely to have over-fit.

In the social science applications I work with, I'm much more concerned with substantive issues, measurement issues, and sensitivity checks. By sensitivity checks I mean estimating variations on the model where terms are added or removed, and estimating models with interactions allowing the effect of interest to vary across sub-groups. How much do these changes to the statistical model affect the parameter estimate we want to interpret causally? Are the discrepancies in this parameter estimate across model specifications or sub-groups understandable in terms of the causal story you are trying to tell, or do they hint at an effect driven by, e.g. selection.

In fact, before you run these alternate specifications. Write down how you think your parameter estimate will change. Its great if your parameter estimate of interest doesn't vary much across sub-groups, or specifications - in the context of my work, that is more important than cross-validation. But other substantive issues affecting my interpretation are more important still.

• Thank you very much for weighing in! Your perspective certainly does put a very direct motivation for cross-validation in causal models I had never cogently formulated myself. IMO your even selling yourself a bit short by using the label of over-fitting. For instance, in the initial exploratory set I may look at model fit between equations using an independent variable on the initial scale versus the log scale. I decide the model with log scale fits better, and then use that in the hold out model. This wouldn't be typically considered over-fitting (choosing between one or the other), cont... – Andy W May 2 '12 at 20:14
• but still fits within the paradigm you suggested in your here's my take paragraph. – Andy W May 2 '12 at 20:15

I thank everyone for their answers, but the question has grown to something I did not intend it to, being mainly an essay on the general notion of causal inference with no right answer.

I initially intended the question to probe the audience for examples of the use of cross validation for causal inference. I had assumed such methods existed, as the notion of using a test sample and hold out sample to assess repeatability of effect estimates seemed logical to me. Like John noted, what I was suggesting isn't dissimilar to bootstrapping, and I would say it resembles other methods we use to validate results such as subset specificity tests or non-equivalent dependent variables (bootstrapping relaxes parametric assumptions of models, and the subset tests in a more general manner are used as a check that results are logical in varied situations). None of these methods meets any of the other answers standards of proof for causal inference, but I believe they are still useful for causal inference.

chl's comment is correct in that my assertion for using cross validation is a check on internal validity to aid in causal inference. But I ask we throw away the distinction between internal and external validity for now, as it does nothing to further the debate. chl's example of genome wide studies in epidemiology I would consider a prime example of poor internal validity, making strong inferences inherently dubious. I think the genome association studies are actually an example of what I asked for. Do you think the inferences between genes and disease are improved through the use of cross-validation (as oppossed to just throwing all markers into one model and adjusting p-values accordingly?)

Below I have pasted a copy of a table in the Berk article I cited in my question. While these tables were shown to demonstrate the false logic of using step-wise selection criteria and causal inference on the same model, lets pretend no model selection criteria were used, and the parameters in both the training and hold out sample were determined A priori. This does not strike me as an unrealistic result. Although I could not say which estimate is correct and which is false, doesn't the inconsistency in the Assault Conviction and the Gun conviction estimates between the two models cast doubt that either has a true causal effect on sentence length? Is knowing that variation not useful? If we lose nothing by having a hold out sample to test our model why can't we use cross-validation to improve causal inference (or I am missing what we are losing by using a hold out sample?)

• A note on why this was downvoted would be appreciated. – Andy W Jan 31 '11 at 15:10
• I'll second @Andy and suggest leaving a comment when downvoting: it's always helpful to learn what's wrong, if any. Especially in this case: Andy W came back with CW extended comments which, in my opinion, add further support to the original question. There's no need to downvote anything here! – chl Feb 6 '11 at 11:10
• Doesn't the standard error/ confidence interval already give you this indication of variability? your test set estimates are contained inside your standard confidence intervals from your training set. I would have thought small standard errors and narrow CIs are important for causality. – probabilityislogic Mar 5 '13 at 13:03
• Yes @probabilityislogic you are correct. I believe when I made this point it wasn't meant for a situation in which you apply CV to an already available dataset, but to a dataset gathered at some other time. I thought CV might be useful here to bolster causal statements, but it still isn't clear to me if that is the case. I have only seen it being arguably useful in terms of model selection, not validating the model in any way (e.g. my model on this new data produces very close fit). – Andy W Mar 12 '13 at 14:36
• @AriB.Friedman, reminds me of Ed Tufte's philosophical signs, Correlation is not causation, but it sure helps. – Andy W Nov 4 '13 at 13:08

I guess this is an intuitive way to think about the relation between CV and causal inference: (please correct if I am wrong)

I always think about CV as a way to evaluate the performance of a model in predictions. However, in causal inference we are more concerned with something equivalent to Occam's Razor (parsimony), hence CV won't help.

Thanks.

• The reason I posed the question is because we don't have to think of cross validation as solely a way to evaluate a models predictive ability. It is not uncommon to be concerned that a models results (and hence inferences made) are artifacts for many potential reasons. Hence we want to examine the robustness of the findings, and I figured cross validation could be a useful context to examine the robustness of the results. – Andy W Oct 25 '10 at 15:18
• sorry for the misinterpretation. – suncoolsu Oct 25 '10 at 18:52
• No need for apologies. I'm the one suggesting something apparently fringe, and cross validation is apparently always used in the context you suggest. – Andy W Oct 26 '10 at 0:07
• @suncoolsu, When I'm thinking about causal inference I never worry about Occam's Razor orparsimony, could you explain the connection to me? – Michael Bishop May 2 '12 at 23:38