CausalityCausality, or causation, is the relationship between causes and effects. In common parlance, an event or state of affairs A is a cause of an event B if A is a reason that brings about the effect B. For instance, one might say "my pushing the accelerator caused the car to go faster." But this definition is somewhat circular; what does it then really mean to say that A is a reason that B occurs? An important question in philosophy and other fields is to clarify the relationship between causes and effects, as well as how (and even if!) causes can bring about effects.
David Hume held that causes and effects are not real (or at least not knowable), but imagined by our mind to make sense of the observation that A often occurs together with or slightly before B. All we can observe are correlations, not causations.
According to law and jurisprudence, legal cause must be demonstrated in order to hold a defendant liable for a crime. It must be proven that causality relates the defendant's actions to the criminal event in question.
In a strict reading, if A causes B, then A must always be followed by B. In this sense, sex does not cause pregnancy, nor does smoking cause cancer. In everyday usage, we therefore often take "A causes B" to mean "A causes an increase in the probability of B".
The establishing of cause and effect, even with this relaxed reading, is notoriously difficult, expressed by the widely accepted statement "correlation does not imply causation". For instance, the observation that smokers have a dramatically increased lung cancer rate does not establish that smoking must be a cause of that increased cancer rate: maybe there exists a certain genetic defect which both causes cancer and a yearning for nicotine.
In statistics, it is generally accepted that observational studies (like counting cancer cases among smokers) can give hints, but can never establish cause and effect. The gold standard for causation here is the randomized experiment: take a large number of randomly selected people, divide them into two groups, force one group to smoke and prohibit the other group from smoking (ideally in a double-blind setup), then determine whether one group develops a significantly higher lung cancer rate. Obviously, for ethical reasons this experiment cannot be performed, but the method is widely applicable for less damaging experiments.
That said, under certain assumptions, parts of the causal structure among several variables can be learned from full covariance or case data by the techniques of Path analysis and more generally, Bayesian networks. Generally these inference algorithms search through the many possible causal structures among the variables, and remove ones which are strongly incompatible with the observed correlations. In general this leaves a set of possible causal relations, which should then be tested by designing appropriate experiments. If experimental data is already available, the algorithms can take advantage of that as well.