CS230 — Original on-site preparation
Independent written study. All essential explanations and optional model reasoning for this chapter are on this page. References are optional further study. No degree, professional approval or observed competence is conferred.
Probability models, distributions and dependence
A sample space lists possible outcomes; an event is a set of outcomes. A probability measure is nonnegative, assigns one to the whole space, and adds probabilities over disjoint events. Consequently P(not A)=1−P(A) and P(A or B)=P(A)+P(B)−P(A and B). A random variable maps outcomes into numerical values. The same outcome can determine several variables, so different columns do not imply independent information.
A joint table assigns probabilities to combinations. Sum over unwanted categories to obtain a marginal. Conditioning restricts the reference group: P(A|B)=P(A and B)/P(B) when P(B)>0. Bayes' rule reverses the direction using P(A|B)=P(B|A)P(A)/P(B). The denominator can be computed by summing P(B|a)P(a) over mutually exclusive, exhaustive categories a. The native rare-defect examples show why sensitivity and alert precision have different denominators; their substantial original worked reasoning remains part of this course.
Independence means joint probabilities factor into marginals for all relevant events. Conditional independence given C means P(A,B|C)=P(A|C)P(B|C), a different assertion. For two independent fair binary variables X and Y, conditioning on X+Y=1 makes them dependent: knowing X=1 forces Y=0. Selecting a subgroup can therefore create associations. Repeating a measurement is not automatically independent confirmation; shared errors or copied fields require a joint model. A chain with the assumption that C is independent of A given B factors as P(A,B,C)=P(A)P(B|A)P(C|B); the factorization follows that stated assumption, not the variable names.
Mass, density, expectation and covariance
A discrete probability mass function sums to one. A probability density f is nonnegative and integrates to one; interval probability is ∫aᵇf(x)dx. A density may exceed one. For a uniform duration on [0,.25] hours, density is four per hour, while probability of a duration in [0,.1] is .4. An exact point has probability zero under this density. A cumulative distribution F(t)=P(X≤t) is nondecreasing, right-continuous and tends to zero and one at the respective infinities. Discrete CDFs jump by point masses. A continuous-density CDF has no jumps, but general distributions can mix discrete and continuous parts.
Expectation is a probability-weighted sum or integral, when it exists. For outcomes 0,2,6 with probabilities .5,.25,.25, E[X]=2 and E[X²]=10, so variance is 10−4=6 and standard deviation is √6. The expected value need not be a likely outcome. A nonlinear decision utility requires E[u(X)], which generally differs from u(E[X]). For u(x)=x², this example gives 10 versus four. Expected values and variance alone do not characterize tail risk.
Linearity gives E[aX+bY]=aE[X]+bE[Y] without independence when expectations exist. Variance needs dependence information: Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y), where Cov(X,Y)=E[XY]−E[X]E[Y]. Correlation divides covariance by both positive standard deviations. Scaling one variable by a negative constant reverses correlation's sign; translating it does not change correlation. Zero covariance does not imply independence. If X is equally likely to be −1,0,1 and Y=X², covariance is zero although Y is completely determined by X.
For a vector, its covariance matrix Σ has variances on the diagonal and pairwise covariances off diagonal. A weighted sum aᵀX has variance aᵀΣa. With Σ=[[4,1],[1,9]] and equal weights [.5,.5], variance is .25×4+.5×1+.25×9=3.75. Dropping the covariance term would give 3.25 and answer a different model.
Moment formulas require finite moments. The standard Cauchy density is 1/[π(1+x²)], not 1/(1+x²); the normalization matters. Its ordinary mean and variance are undefined. Symmetric cancellation can give a principal value zero without creating a finite expectation. For any finite-variance distribution with positive standard deviation, Chebyshev bounds P(|X−μ|≥kσ)≤1/k². At k=2 this bounds the outside probability by .25; it does not assert that exactly 75% are inside or that the distribution is normal.
Select a distribution by its experiment
A Bernoulli(p) variable records one binary outcome, with mean p and variance p(1−p). A binomial(n,p) count sums n independent Bernoulli trials with the same p: P(K=k)=choose(n,k)pᵏ(1−p)ⁿ⁻ᵏ, mean np and variance np(1−p). For n=4,p=.25, probability of exactly one success is 4×.25×.75³=.421875, with mean one and variance .75. A finite count with changing probabilities or dependent trials need not be binomial.
A discrete uniform variable on integers 1 through m has mass 1/m, mean (m+1)/2 and variance (m²−1)/12. A library's exclusive upper bound requires m+1 to include m. A continuous uniform variable on [a,b], a<b, has density 1/(b−a), mean (a+b)/2 and variance (b−a)²/12. Equal density means probabilities scale with interval length; it does not assign positive equal mass to every real point.
A Poisson(λ) count has P(K=k)=exp(−λ)λᵏ/k!, mean and variance λ. λ is the expected count over the declared exposure, not automatically a per-hour rate. A rate of two arrivals/hour over three hours gives λ=6 under a homogeneous Poisson-process model. Independent increments and a suitable event mechanism must be justified; clustering can defeat the model. Its CDF sums masses from zero through floor(t); a finite plotting grid does not make the remaining tail vanish.
A normal distribution N(μ,σ²), σ>0, has density exp[−(x−μ)²/(2σ²)]/(σ√(2π)). Standardization Z=(X−μ)/σ expresses values in standard-deviation units. For independent identically distributed observations with finite mean and finite nonzero variance, the classical central limit theorem describes the standardized sum approaching a standard normal distribution. It does not make the original observations normal or supply a universal sample-size cutoff. The law of large numbers concerns convergence of averages under suitable assumptions; neither law removes selection bias or dependence by increasing row count.
An exponential-family representation has form h(x)exp[η·T(x)−A(η)] with A normalizing the distribution. For Bernoulli p in (0,1), η=ln[p/(1−p)], T(x)=x, h(x)=1 and A(η)=ln(1+exp η). Substituting x=0 or 1 recovers 1−p and p. For independent observations the summed successes and sample count retain the parameter-dependent likelihood information in this model. Sufficient statistics are model-relative, not a claim that discarded data contain nothing relevant to any other question. A uniform distribution whose support itself depends on an unknown parameter needs additional qualifications before applying regular exponential-family results.
Optional changed record and reasoning
Change the three-outcome probabilities to [.25,.5,.25]. Calculate mean and variance. For the binomial example change p to .5, keeping n=4. Finally change the covariance matrix's off-diagonal entries from one to −one, retaining equal weights.
The mean becomes .25×0+.5×2+.25×6=2.5, and second moment is .5×4+.25×36=11. Variance is 11−2.5²=4.75. For the binomial, probability of exactly one success is 4(.5)⁴=.25, mean is two and variance is one. Equal-weight variance becomes one−.5+2.25=2.75. The same marginal variances can therefore yield a different aggregate risk because covariance changed. None of these constructed calculations establishes real arrival independence, a causal mechanism or population representativeness.
Optional criteria: state a sample space and conditioning denominator; distinguish mass from density; calculate moments and dependence terms; justify distribution assumptions and limitations. Award one point per fully explained criterion.
Optional source references
These sources support the explanations; reading them is optional. Original Academy examples are fictional. Historical attributed readings remain preserved.