STAT-15 · STATISTICS

회귀·조건부 평균·추론과 진단Regression, conditional means, inference and diagnostics

다섯 점의 직선에서 실제 자료의 기울기·두 구간·영향 진단까지From a five-point line to actual slopes, two interval targets and influence diagnostics

실습 6종 · 풀이 포함 연습문제 60개6 labs · 60 exercises with solutions

기초Foundations

1. 직선을 그리는 일과 설명을 믿는 일은 다르다1. Drawing a line and trusting an explanation are different tasks

키가 큰 사람이 대체로 더 무겁다는 산점도를 보면 ‘키가 1cm 늘 때 예측 몸무게는 얼마나 달라질까?’라고 물을 수 있습니다. 그러나 서로 다른 사람을 비교한 직선이 한 사람의 키를 바꾸는 인과 실험은 아닙니다. 직선을 계산하는 것, 평균을 추정하는 것, 새 관측을 예측하는 것을 나누어 시작합니다.

수리기초에서 최소제곱의 투영을 배웠다면 이 장은 그 계산 위에 통계적 조건을 얹습니다. 처음 읽는 학생은 다섯 점을 손으로 맞춘 뒤, 조건부 평균·기울기 표준오차·예측 구간·진단으로 차례로 올라가면 됩니다.

A height-versus-mass scatterplot can motivate “How much does predicted mass change per additional centimeter?” A line comparing different people is not an intervention changing one person's height. Separate fitting a line, estimating a mean and predicting a new observation.

This chapter adds statistical assumptions to least-squares projection. New readers can begin with five hand-calculated points, then move through conditional means, slope uncertainty, prediction and diagnostics.

기초Foundations

2. x와 y의 역할·단위·관측 단위를 먼저 적는다2. State predictor, response, units and observational units

x는 설명 좌표, y는 맞추려는 응답입니다. 이 명칭이 곧 원인과 결과를 뜻하지는 않습니다. 서로 바꾸어 회귀하면 제곱하는 방향과 기울기의 단위가 바뀌므로 일반적으로 원래 직선의 역함수가 되지 않습니다.

기울기의 단위는 y 단위/x 단위입니다. 국가 사례에서는 x가 1인당 실질 GDP를 10000으로 나눈 좌표이고 y는 기간 기대수명(년)입니다. 개인 사례는 학력 연수와 원 로그 임금, 제품 사례는 알코올 부피백분율과 순서형 품질 점수입니다.

한 국가·개인·제품 기록의 한 쌍을 같은 행으로 유지합니다. 순서형 점수에 숫자 제곱오차를 쓰는 것은 선택한 모형이며, 점수 사이 실질 간격이 같다는 사실을 새로 관측한 것이 아닙니다.

x is a predictor coordinate and y the fitted response, not automatically cause and effect. Reversing their roles changes the direction of squared errors and generally does not produce an inverse line.

Slope units are response units per predictor unit. Our country predictor is real GDP per capita divided by 10000, with period life expectancy in years as response. Person records use schooling and source log wages; product records use alcohol percent by volume and ordinal quality.

Keep paired values on the same observational record. Numerical squared loss for an ordinal score is a modeling choice, not evidence that substantive score intervals are equal.

기초Foundations

3. 산점도 한 점의 두 값과 원자료 키를 함께 보존한다3. Preserve both coordinates and the source key of each point

두 열을 따로 정렬한 뒤 같은 줄끼리 짝지으면 다른 자료를 만듭니다. x 또는 y가 없는 기록은 이 장의 완전짝 분석에서 함께 제외하되 원자료의 결측과 키는 남깁니다. 각각의 가용 열을 따로 뽑아 길이만 맞추면 안 됩니다.

산점도는 범위·군집·곡률·극단 위치를 먼저 보여줍니다. 같은 좌표의 여러 기록은 겹쳐 보일 수 있으므로 점 하나가 언제나 관측 하나라는 표시를 가정하지 않습니다. 동일한 수치 행도 근거 없이 중복 오류라고 삭제하지 않습니다.

실습 입력의 행 위치와 실제 자료의 키는 다릅니다. 국가는 국가 코드, 개인은 원 인원 코드, 제품은 원행 번호를 씁니다. 이 키만으로 평생 추적한 개인·독립 생산 배치임을 추가로 주장하지 않습니다.

Sorting columns separately destroys pairing. Jointly omit records lacking either coordinate for this complete-pair analysis, while preserving missingness and source keys. Do not independently extract two available columns and align them by length.

Inspect range, clusters, curvature and extreme positions first. Repeated coordinates can overlap, so a visible point need not represent one record. Identical numeric rows are not automatically errors to delete.

Typed-input positions differ from actual source keys:country codes, reported person codes and product source-row numbers. Those keys do not establish lifetime tracking or independent production batches.

기초Foundations

4. 잔차는 같은 x에서 관측과 직선의 세로 차이다4. A residual is the vertical observation-minus-line difference

가상 직선 ŷ=1+0.8x에서 x=2이면 적합값은 2.6입니다. 그 지점의 관측 y=2라면 잔차는 −0.6입니다. 음수는 관측이 직선 아래에 있다는 뜻입니다. 잔차 단위는 y와 같습니다.

y^i=a+bxi,ei=yi−y^i.\begin{aligned} \widehat y_i&=a+bx_i,\\ e_i&=y_i-\widehat y_i. \end{aligned}

이것은 그림에서 직선까지의 가장 짧은 수직선 거리와 다릅니다. 여기서 ‘세로’는 y축 방향을 뜻합니다. x와 y를 서로 다른 단위로 그린 산점도의 기하학적 최단거리를 곧바로 오차로 쓰지 않습니다.

On the hypothetical line ŷ=1+.8x, the fit at x=2 is 2.6. Observed y=2 gives residual −.6, meaning below the line. Residual units match y.

y^i=a+bxi,ei=yi−y^i.\begin{aligned} \widehat y_i&=a+bx_i,\\ e_i&=y_i-\widehat y_i. \end{aligned}

This is not the shortest perpendicular distance to the line. “Vertical” means along the response axis. A geometric distance on axes with different units is another loss choice.

기초Foundations

5. 최소제곱은 세로 잔차 제곱의 합을 줄인다5. Least squares minimizes the sum of vertical squared residuals

양·음 잔차를 그냥 더하면 큰 오차가 서로 지워질 수 있습니다. 제곱은 부호를 없애고 큰 오차에 더 큰 비용을 줍니다. 두 수 a, b를 바꾸어 제곱합이 가장 작아지는 직선을 찾습니다.

Q(a,b)=∑i=1n(yi−a−bxi)2.Q(a,b)=\sum_{i=1}^{n}(y_i-a-bx_i)^2.

절대오차를 줄이는 직선, 이상값에 덜 민감한 손실, 불확실한 x를 함께 다루는 모형은 다른 문제입니다. 최소제곱은 모든 상황에 자동 최선이라는 뜻이 아닙니다. 우선 선택한 목적함수의 정확한 답부터 구합니다.

분모 n이나 2n을 붙여도 양의 상수배이므로 같은 최소점을 줍니다. 그러나 최소점의 계산과 모집단에 대한 통계적 최적성은 별도 주장입니다.

Signed errors can cancel. Squaring removes signs and penalizes large errors more heavily. Vary a, b to minimize the chosen objective.

Q(a,b)=∑i=1n(yi−a−bxi)2.Q(a,b)=\sum_{i=1}^{n}(y_i-a-bx_i)^2.

Absolute loss, robust losses and errors-in-predictors models ask different optimization questions. Least squares is not automatically optimal for every purpose; first solve the stated loss.

Dividing by n or 2n leaves the minimizer unchanged. Numerical minimization and statistical optimality about a population remain separate claims.

기초Foundations

6. 절편을 먼저 맞추면 직선은 평균점을 지난다6. Optimizing the intercept makes the line pass through the means

b를 잠시 고정하면 yᵢ−bxᵢ라는 수들에 공통 상수 a를 맞추는 문제입니다. 제곱오차를 가장 작게 하는 상수는 그 수들의 평균이므로 a=ȳ−bx̄입니다. 이는 평균의 완전제곱 원리로도, 미분으로도 확인할 수 있습니다.

a(b)=y‾−bx‾,yi−a(b)−bxi=(yi−y‾)−b(xi−x‾).\begin{aligned} a(b)&=\overline y-b\overline x,\\ y_i-a(b)-bx_i &=(y_i-\overline y)-b(x_i-\overline x). \end{aligned}

따라서 절편이 있는 적합 직선은 (x̄,ȳ)를 지납니다. x=0이 관측 범위 밖이면 원절편은 먼 외삽 값일 수 있습니다. x−x̄를 새 좌표로 쓰면 절편은 ȳ가 되어 해석하기 쉬워집니다.

Hold b fixed. Fitting a constant a to yᵢ−bxᵢ gives their mean, a=ȳ−bx̄, by the squared-loss mean identity or differentiation.

a(b)=y‾−bx‾,yi−a(b)−bxi=(yi−y‾)−b(xi−x‾).\begin{aligned} a(b)&=\overline y-b\overline x,\\ y_i-a(b)-bx_i &=(y_i-\overline y)-b(x_i-\overline x). \end{aligned}

An intercept fit therefore passes through (x̄,ȳ). If zero lies outside the observed x range, the raw intercept is an extrapolation. Centering x at x̄ makes the intercept ȳ without changing fitted values.

기초Foundations

7. 중심화 곱합을 중심화 제곱합으로 나눈다7. Divide centered cross-products by centered predictor squares

uᵢ=xᵢ−x̄, vᵢ=yᵢ−ȳ라고 놓으면 Q는 Σ(vᵢ−buᵢ)²입니다. 전개하면 Syy−2bSxy+b²Sxx입니다. Sxx>0일 때 b의 완전제곱을 만들면 유일한 최소점을 얻습니다.

Sxx=∑i(xi−x‾)2Sxy=∑i(xi−x‾)(yi−y‾)b^=Sxy/Sxxa^=y‾−b^ x‾\begin{gathered}S_{xx}=\sum_i(x_i-\overline x)^2\\S_{xy}=\sum_i(x_i-\overline x)(y_i-\overline y)\\\widehat b=S_{xy}/S_{xx}\\\widehat a=\overline y-\widehat b\,\overline x\end{gathered}

중심화 x의 퍼짐이 없으면 기울기와 절편을 따로 정할 수 없습니다. Sxy는 함께 움직이는 방향을, Sxx는 기울기 한 단위가 적합값에 얼마나 작용하는지를 반영합니다. 이 공식 자체는 확률 가정 없이 고정 수치 자료에 성립합니다.

With uᵢ=xᵢ−x̄ and vᵢ=yᵢ−ȳ, the objective expands to Syy−2bSxy+b²Sxx. Completing its square gives a unique minimum when Sxx>0.

Sxx=∑i(xi−x‾)2Sxy=∑i(xi−x‾)(yi−y‾)b^=Sxy/Sxxa^=y‾−b^ x‾\begin{gathered}S_{xx}=\sum_i(x_i-\overline x)^2\\S_{xy}=\sum_i(x_i-\overline x)(y_i-\overline y)\\\widehat b=S_{xy}/S_{xx}\\\widehat a=\overline y-\widehat b\,\overline x\end{gathered}

Without predictor variation, slope and intercept are not separately determined. Sxy captures co-movement and Sxx the scale of predictor variation. These formulas are finite-data algebra without probabilistic assumptions.

기초Foundations

8. 다섯 점의 직선을 손으로 완성한다8. Fit a line to five hand-calculated points

가상 자료 x=(0,1,2,3,4), y=(1,2,2,4,4)를 씁니다. 평균은 x̄=2,ȳ=13/5입니다. x 편차는 (−2,−1,0,1,2)이므로 Sxx=10입니다. Σ(x−2)y=−2−2+0+4+8=8이고 Σ(x−2)=0이라 이것이 Sxy입니다.

b^=8/10=4/5,a^=13/5−(4/5)2=1,y^=1+(4/5)x,e=(0,1/5,−3/5,3/5,−1/5),SSE=(1+9+9+1)/25=4/5.\begin{aligned} \widehat b&=8/10=4/5,\\ \widehat a&=13/5-(4/5)2=1,\\ \widehat y&=1+(4/5)x,\\ e&=(0,1/5,-3/5,3/5,-1/5),\\ SSE&=(1+9+9+1)/25=4/5. \end{aligned}

모든 점이 직선 위에 놓이지 않아도 직선을 맞출 수 있습니다. 이 수치는 설명용 가상 자료이며 실제 국가·개인·제품 관측은 후반에서 원자료로 따로 계산합니다.

Use hypothetical x=(0,1,2,3,4), y=(1,2,2,4,4). Means are 2 and 13/5; centered x is (−2,−1,0,1,2), giving Sxx=10. The sum Σ(x−2) y=8 equals Sxy because centered x sums to zero.

b^=8/10=4/5,a^=13/5−(4/5)2=1,y^=1+(4/5)x,e=(0,1/5,−3/5,3/5,−1/5),SSE=(1+9+9+1)/25=4/5.\begin{aligned} \widehat b&=8/10=4/5,\\ \widehat a&=13/5-(4/5)2=1,\\ \widehat y&=1+(4/5)x,\\ e&=(0,1/5,-3/5,3/5,-1/5),\\ SSE&=(1+9+9+1)/25=4/5. \end{aligned}

A fit need not interpolate all points. These illustrative values are hypothetical; later actual examples are separately computed from retained source records.

기초Foundations

9. 실습 A: 원자료와 직선·잔차를 함께 바꾼다9. Lab A: vary records and inspect line and residuals together

한 쌍을 바꾸어 기울기·절편·적합값·잔차 제곱합이 어떻게 바뀌는지 확인하세요. 점을 y축 방향으로 올리면 가까운 x의 점만이 아니라 직선 전체가 바뀔 수 있습니다. 원자료와 계산된 적합값은 표에서 분리합니다.

완전짝 0개, 상수 x, 상수 y, 정확히 두 점도 시험하세요. 상수 x에서는 절편과 기울기가 비유일입니다. 상수 y와 변하는 x에서는 기울기 0의 직선은 계산되지만 R² 분모는 0입니다. 두 점의 직선 계산과 잔차분산을 추정한 t검정은 다른 요구를 가집니다.

Edit a pair and inspect slope, intercept, fits and residual squared sum. Moving one response can change the entire line. The table distinguishes source values from derived fits.

Try no complete pairs, constant x, constant y and exactly two points. Constant x leaves coefficients nonunique. Constant y with varying x permits a zero-slope fit but makes R² undefined. Fitting a two-point line does not provide residual df for a t test.

기초Foundations

10. 잔차 합 0은 맞춤 조건이지 무작위성 증거가 아니다10. Zero residual sums are fitting conditions, not evidence of randomness

절편과 기울기 방향으로 목적함수를 최소화하면 잔차는 상수 벡터와 x 벡터에 직교합니다. 기본 자료에서 잔차 합은 0이고 Σxe도 0입니다. 이 조건은 입력한 자료가 어떤 모양이든 최소제곱 계산에서 생깁니다.

∑iei=0,∑ixiei=0.\begin{aligned} \sum_i e_i&=0,\\ \sum_i x_ie_i&=0. \end{aligned}

따라서 잔차 평균이 0이라는 사실로 모집단 E[ε|X]=0을 검증했다고 말할 수 없습니다. 잔차들이 서로 독립이라는 결론도 없습니다. 절편 없는 적합에서는 첫 조건이 일반적으로 성립하지 않습니다.

입력한 정확 십진·분수를 보존하면 이 조건을 정확 유리수로 검사할 수 있습니다. 표시 소수의 작은 오차와 실제 정규방정식 실패는 구별합니다.

Minimizing along intercept and slope directions makes residuals orthogonal to constant and predictor vectors. The default residuals sum to zero and satisfy Σxe=0, as fitting conditions for the observed data.

∑iei=0,∑ixiei=0.\begin{aligned} \sum_i e_i&=0,\\ \sum_i x_ie_i&=0. \end{aligned}

These identities do not verify population E[ε|X]=0 or independent residuals. Without an intercept, the first identity need not hold.

Retained exact decimal/fraction inputs permit exact rational checks. Small displayed rounding is different from failure of the normal equations.

기초Foundations

11. 모든 x가 같으면 관측 범위 밖의 직선은 정해지지 않는다11. Constant x leaves the line away from observed support unidentified

xᵢ=c가 모두 같으면 적합값은 a+bc라는 공통 상수뿐입니다. 이 값을 ȳ에 맞추는 모든 (a, b)가 최소점입니다. 예를 들어 c=2,ȳ=3이면 (a, b)=(3,0),(1,1),(−1,2)가 모두 관측 x에서 같은 값 3을 만듭니다.

관측된 x=c에서의 적합값은 유일할 수 있어도 기울기나 다른 x의 예측은 비유일입니다. 이 장 실습은 임의 계수를 선택해 유일한 직선처럼 표시하지 않습니다. 완전짝 한 개에서도 같은 문제가 생깁니다.

이것은 정보의 랭크 문제입니다. 반올림 때문에 서로 다른 x를 모두 같게 저장한 경우에는 입력 정밀도도 확인해야 합니다. 실제 측정 단위 변경과 수치 정보 손실은 다릅니다.

If every xᵢ=c, only a+bc affects fits. Any coefficients making this constant equal ȳ minimize loss. For c=2,ȳ=3, coefficients (3,0),(1,1),(−1,2) all fit value 3 at the observed predictor.

The fit at c can be unique while slope and predictions elsewhere are not. The lab refuses to select an arbitrary unique line. One complete pair has the same rank issue.

Check whether input rounding collapsed originally distinct predictors. Rank information loss differs from a valid unit conversion.

기초Foundations

12. R²는 이 자료의 중심화 제곱합에 대한 적합 몫이다12. R squared describes the fitted share of centered variation

절편이 있는 최소제곱에서는 y−ȳ=(ŷ−ȳ)+e의 직교 분해가 성립합니다. 따라서 SST=SSR+SSE이고, 비상수 y이면 R²=1−SSE/SST가 0과 1 사이입니다. 기본 자료는 SST=36/5, SSE=4/5라 R²=8/9입니다.

SST=∑i(yi−y‾)2,R2=1−SSESST,SST>0.\begin{aligned} SST&=\sum_i(y_i-\overline y)^2,\\ R^2&=1-\frac{SSE}{SST},\qquad SST>0. \end{aligned}

이는 자료 안의 제곱합 요약입니다. ‘88.9%의 사람을 정확히 예측’이나 ‘x가 y의 88.9%를 인과적으로 만든다’는 뜻이 아닙니다. 높은 R²에서도 곡률·의존·외삽 오류가 있을 수 있습니다. 절편 없는 다른 R² 정의를 이 범위 정리와 섞지 않습니다.

Intercept OLS splits y−ȳ orthogonally into fitted deviation plus residual, so SST=SSR+SSE. For nonconstant y, R²=1−SSE/SST lies between zero and one. The default has SST=36/5 and SSE=4/5, giving R²=8/9.

SST=∑i(yi−y‾)2,R2=1−SSESST,SST>0.\begin{aligned} SST&=\sum_i(y_i-\overline y)^2,\\ R^2&=1-\frac{SSE}{SST},\qquad SST>0. \end{aligned}

This is an in-data squared-variation summary, not a fraction of people predicted correctly or a causal contribution. High R² can coexist with curvature, dependence and extrapolation failure. Do not apply this intercept-based result to differently defined no-intercept R².

기초Foundations

13. 기울기는 상관에 y와 x의 척도 비를 곱한다13. Slope combines correlation with the response-to-predictor scale ratio

Sxx, Syy가 모두 양수이면 r=Sxy/√(SxxSyy)이고 b̂=r√(Syy/Sxx)입니다. 둘을 같은 ddof 분모로 표준편차로 바꾸면 b̂=r·sy/sx입니다. r은 무차원이지만 기울기는 단위를 가집니다.

b^=r sysx,Sxx>0, Syy>0,R2=r2for simple intercept OLS.\begin{aligned} \widehat b&=r\,\frac{s_y}{s_x}, &&S_{xx}>0,\ S_{yy}>0,\\ R^2&=r^2 &&\text{for simple intercept OLS.} \end{aligned}

y가 상수면 b̂=0은 정의되어도 r은 미정의입니다. 상관 r=0이면 가장 좋은 직선의 기울기가 0일 뿐, 모든 비선형 관계가 사라지는 것은 아닙니다. x=(−1,0,1), y=x²는 대표적인 반례입니다.

With positive Sxx and Syy, r=Sxy/√(SxxSyy) and b̂=r·sy/sx when both SDs use the same denominator. Correlation is dimensionless while slope carries units.

b^=r sysx,Sxx>0, Syy>0,R2=r2for simple intercept OLS.\begin{aligned} \widehat b&=r\,\frac{s_y}{s_x}, &&S_{xx}>0,\ S_{yy}>0,\\ R^2&=r^2 &&\text{for simple intercept OLS.} \end{aligned}

Constant y allows b̂=0 but leaves r undefined. Zero correlation makes the best line flat, not every nonlinear relationship absent; x=(−1,0,1), y=x² is a counterexample.

기초Foundations

14. 조건부 평균은 같은 x 정보에서의 평균 반응이다14. A conditional mean summarizes response given predictor information

모집단에서 m(x)=E[Y|X=x]를 생각합니다. ‘같은 x인 사람을 많이 반복해 본다면 y의 평균은?’이라는 질문입니다. 제곱적분 가능한 Y에서는 모든 예측 함수 중 조건부 평균이 평균 제곱손실을 최소화합니다.

조건부 평균은 직선일 필요가 없습니다. 같은 키에서의 평균 몸무게가 어떤 구간에서는 빠르게, 다른 구간에서는 천천히 바뀔 수 있습니다. 직선을 맞췄다는 사실은 모집단 m(x)=a+bx임을 증명하지 않습니다.

연속 X에서 P(X=x)=0인 점의 조건부 평균은 단순 사건 비율로 정의하지 않습니다. 적절한 조건부 기대값 버전의 함수로 다루며, 자료가 지지하지 않는 점의 값은 추가 모형 없이 식별되지 않을 수 있습니다.

Think of population m(x)=E[Y|X=x]:the average response given predictor information. For square-integrable Y, the conditional mean minimizes expected squared loss over measurable predictors.

It need not be linear. A fitted straight line does not prove m(x)=a+bx in the population.

For continuous X, conditioning at a zero-probability point is not an ordinary event ratio. Use a suitable conditional-expectation version; values unsupported by the data may need additional modeling assumptions.

학부 연결 · 선택Undergraduate bridge · optional

15. 조건부 평균에서 벗어난 만큼 제곱 위험이 더해진다15. Departure from the conditional mean adds squared risk

Y와 예측 g(X)가 제곱적분 가능하다고 합시다. Y−g=(Y−m)+(m−g)를 제곱합니다. 교차항은 X에 조건을 걸면 E[Y−m|X]=0이므로 사라집니다.

E[(Y−g(X))2]=E[(Y−m(X))2]+E[(m(X)−g(X))2]\begin{gathered}E[(Y-g(X))^2]\\=E[(Y-m(X))^2]\\\quad+E[(m(X)-g(X))^2]\end{gathered}

오른쪽 첫 항은 그 X 정보만으로 없앨 수 없는 제곱 변동이고, 둘째는 예측 함수를 잘못 고른 추가 위험입니다. 선택한 g가 모집단의 최소점인지와 유한 자료에서 얼마나 정확히 배웠는지는 다시 나누어야 합니다. 훈련 제곱합이 작다는 것만으로 새 자료 위험이 작아지지는 않습니다.

Assume Y and g(X) are square-integrable. Expand Y−g=(Y−m)+(m−g). Conditioning on X kills the cross term through E[Y−m|X]=0.

E[(Y−g(X))2]=E[(Y−m(X))2]+E[(m(X)−g(X))2]\begin{gathered}E[(Y-g(X))^2]\\=E[(Y-m(X))^2]\\\quad+E[(m(X)-g(X))^2]\end{gathered}

The first term is variation unresolved by this information; the second is extra risk from the chosen predictor. Population optimality and finite-data estimation accuracy are different. Small training SSE alone does not guarantee small new-data risk.

학부 연결 · 선택Undergraduate bridge · optional

16. 가장 좋은 직선은 가장 좋은 모든 함수와 다를 수 있다16. The best line can differ from the best unrestricted predictor

X, Y가 제곱적분 가능하고 Var(X)>0이면 E[(Y−a−bX)²]를 최소화하는 모집단 직선의 기울기는 Cov(X, Y)/Var(X)입니다. 이 값은 직선이라는 제한 안의 최선입니다.

b⋆=Cov⁡(X,Y)Var⁡(X),a⋆=E[Y]−b⋆E[X].\begin{aligned} b^\star&=\frac{\operatorname{Cov}(X,Y)}{\operatorname{Var}(X)},\\ a^\star&=E[Y]-b^\star E[X]. \end{aligned}

가상 X가 −1,0,1을 같은 확률로 갖고 Y=X²이면 m(X)=X²입니다. 대칭으로 Cov=0이라 최선 직선은 상수 2/3이지만, 곡선 X²는 완벽히 맞습니다. 선형 잔차가 X와 직교한다고 조건부 잔차 평균까지 0인 것은 아닙니다.

실제 자료의 표본 직선, 모집단 최선 선형 요약, 참 조건부 평균, 인과 반응 함수는 서로 다른 대상입니다. 질문에 필요한 대상을 먼저 고릅니다.

For square-integrable X, Y with Var(X)>0, the population line minimizing E[(Y−a−bX)²] has slope Cov(X, Y)/Var(X). Its optimality is restricted to lines.

b⋆=Cov⁡(X,Y)Var⁡(X),a⋆=E[Y]−b⋆E[X].\begin{aligned} b^\star&=\frac{\operatorname{Cov}(X,Y)}{\operatorname{Var}(X)},\\ a^\star&=E[Y]-b^\star E[X]. \end{aligned}

If X is uniform on −1,0,1 and Y=X², the conditional mean is X². Symmetry makes covariance zero, so the best line is constant 2/3 while the nonlinear predictor is exact. Orthogonality to X does not force zero conditional residual mean.

Distinguish the sample fit, population best linear summary, true conditional mean and causal response function before choosing an interpretation.

기초Foundations

17. 같은 보고 x의 표본 평균도 모집단 함수와 구별한다17. Means at the same reported x are still sample summaries

자료에서 x=12인 기록들의 y를 평균 내면 관측된 조건부 표본 평균입니다. 이 값이 모집단 E[Y|X=12]와 정확히 같다고 할 수는 없습니다. 표집 오차와 선택이 있고, 보고 x의 반올림으로 여러 기저 값이 묶였을 수도 있습니다.

가상 x=(0,0,1,1,2,2), y=(1,3,2,6,5,7)의 같은 x 평균은 2,4,6입니다. 직선은 이 그룹 수가 같을 때 이 세 평균을 중심으로 맞춥니다. 그룹 평균이 곡선이면 전체 OLS는 그 값을 모두 지나지 않을 수 있습니다.

같은 x 평균을 표로 요약하면 집단 안 변동이 사라질 수 있습니다. 원자료를 평균과 크기로만 바꾼 회귀의 계수가 같더라도, 잔차 제곱합과 SE까지 단순히 같은 것으로 놓으면 안 됩니다.

Averaging y among reported x=12 records gives an observed conditional sample mean, not an exact population E[Y|X=12]. Sampling, selection and rounding of reported x can matter.

For hypothetical x=(0,0,1,1,2,2), y=(1,3,2,6,5,7), same-x means are 2,4,6. OLS follows these equally sized groups, but cannot generally interpolate nonlinear group means.

Replacing raw records by means can discard within-group variation. Even if weighted mean regression preserves coefficients, it need not preserve a naively computed residual SSE or SE.

기초Foundations

18. 실습 B: 그룹 평균과 직선이 어디서 다른지 본다18. Lab B: compare same-x means with the fitted line

동일 x가 반복되는 자료를 넣어 그룹 크기·관측 평균·직선 값·둘의 차이를 읽으세요. 한 x에서 응답을 바꾸면 그룹 평균은 그 자리에서 변하지만 직선은 다른 x의 적합값도 바꿀 수 있습니다.

x=(−1,0,1), y=(1,0,1)도 시험하세요. 관측된 동일 x 평균은 곡선처럼 바뀌지만 최선 직선은 평평합니다. ‘기울기 0’과 ‘조건부 평균이 어디서나 같음’을 구별하는 작은 반례입니다. 한 점뿐인 그룹 평균도 계산되지만 그 그룹의 모집단 평균을 정확히 안다는 뜻은 아닙니다.

Enter repeated x values and compare counts, observed group means, line values and differences. Changing one response changes its local group mean but can move the fitted line elsewhere as well.

Try x=(−1,0,1), y=(1,0,1). Same-x means vary nonlinearly while the best line is flat. Zero linear slope does not mean a constant conditional mean. A singleton group mean is calculable without identifying a population mean exactly.

기초Foundations

19. 고정 x 선형 평균 모형을 따로 선언한다19. Declare a fixed-design linear-mean model separately

이제 추론을 위해 x₁,…, xₙ을 고정한 모형을 세웁니다. Yᵢ=a+bxᵢ+εᵢ, E[εᵢ]=0이면 각 x에서 평균이 a+bxᵢ입니다. 원자료를 넣었다고 이 모형이 확인된 것은 아닙니다.

Yi=a+bxi+εi,E[εi]=0,Sxx>0.\begin{aligned} Y_i&=a+bx_i+\varepsilon_i,\\ E[\varepsilon_i]&=0,\qquad S_{xx}>0. \end{aligned}

무작위 X를 쓰면 전체 설계 X에 조건을 건 평균 0 같은 조건으로 읽을 수 있습니다. 단순히 ε와 X의 상관이 0이라는 약한 조건과 같지는 않습니다. 고전 정확 t까지 얻으려면 독립 정규·공통 양의 분산을 더 가정합니다.

설명 변수가 여러 개일 때도 ‘선형’은 계수에 대해 선형이라는 뜻입니다. x²를 열로 넣는 모형은 곡선을 그릴 수 있습니다. 이 장은 단순 회귀의 조건을 충분히 익힌 뒤 다변량 확장으로 연결합니다.

For inference, first fix x₁,…, xₙ and state Yᵢ=a+bxᵢ+εᵢ with zero-mean errors. This gives mean a+bxᵢ at each design point; entering real records does not verify it.

Yi=a+bxi+εi,E[εi]=0,Sxx>0.\begin{aligned} Y_i&=a+bx_i+\varepsilon_i,\\ E[\varepsilon_i]&=0,\qquad S_{xx}>0. \end{aligned}

For random predictors, read an appropriate zero-mean condition given the entire design. Mere zero correlation with X is weaker. Exact classical t adds independent normal errors with common positive variance.

“Linear” refers to coefficients:including an x² column can describe curvature. First establish simple-regression conditions before extending the design matrix.

학부 연결 · 선택Undergraduate bridge · optional

20. 기울기를 오차들의 가중합으로 쓰면 불편성 조건이 보인다20. Expressing slope as a weighted error sum reveals unbiasedness conditions

선형 평균 모형을 기울기 공식에 넣으세요. 상수항은 Σ(x−x̄)=0으로 없어지고 b항은 Sxx를 만들어 정확히 b가 남습니다. 오차의 가중합만 추가됩니다.

b^−b=∑iwiεi,wi=xi−x‾Sxx,E[b^]=bif every E[εi]=0.\begin{aligned} \widehat b-b &=\sum_i w_i\varepsilon_i,\\ w_i&=\frac{x_i-\overline x}{S_{xx}},\\ E[\widehat b]&=b \quad\text{if every }E[\varepsilon_i]=0. \end{aligned}

이 기대값 계산에는 오차 사이 독립이나 정규성이 필요하지 않습니다. 그러나 잘못된 선형 평균·표집 선택 때문에 오차 평균이 0이 아니면 결론이 달라집니다. 고정 x의 이 b와 인과 효과 b라는 해석도 별도입니다.

Substitute the linear-mean model into the slope formula. The constant term cancels through Σ(x−x̄)=0, and the slope term produces bSxx.

b^−b=∑iwiεi,wi=xi−x‾Sxx,E[b^]=bif every E[εi]=0.\begin{aligned} \widehat b-b &=\sum_i w_i\varepsilon_i,\\ w_i&=\frac{x_i-\overline x}{S_{xx}},\\ E[\widehat b]&=b \quad\text{if every }E[\varepsilon_i]=0. \end{aligned}

Neither error independence nor normality is needed for this expectation calculation. Misspecified means or selection can violate zero error means. A causal interpretation of b is another requirement.

학부 연결 · 선택Undergraduate bridge · optional

21. 공통분산과 독립을 더하면 기울기 분산이 단순해진다21. Independent common-variance errors simplify slope variance

오차가 서로 독립이고 Var(εᵢ)=σ²이면 가중합 분산은 σ²Σwᵢ²입니다. Σ(x−x̄)²=Sxx를 이용하면 σ²/Sxx가 됩니다. 정규성은 이 분산 항등식에 필요하지 않습니다.

Var⁡(b^)=σ2∑i(xi−x‾)2Sxx2=σ2Sxx.\begin{aligned} \operatorname{Var}(\widehat b) &=\sigma^2\sum_i\frac{(x_i-\overline x)^2}{S_{xx}^2}\\ &=\frac{\sigma^2}{S_{xx}}. \end{aligned}

다른 조건이 같으면 x가 더 넓게 퍼질수록 기울기 변동이 작아집니다. 하지만 관측 범위를 무작정 넓히면 선형 평균 가정이 틀릴 수 있습니다. 시간·군집 의존이 있으면 공분산 교차항도 남아 이 식을 그대로 쓸 수 없습니다.

With independent errors of variance σ², the weighted-sum variance is σ²Σwᵢ². Using the centered-square identity gives σ²/Sxx, without requiring normality.

Var⁡(b^)=σ2∑i(xi−x‾)2Sxx2=σ2Sxx.\begin{aligned} \operatorname{Var}(\widehat b) &=\sigma^2\sum_i\frac{(x_i-\overline x)^2}{S_{xx}^2}\\ &=\frac{\sigma^2}{S_{xx}}. \end{aligned}

Wider predictor variation reduces slope variance all else equal, but expanding range can invalidate a linear mean. Time or cluster dependence introduces covariance cross terms, so the simple formula need not apply.

기초Foundations

22. 두 계수를 맞춘 뒤 남은 n−2로 나눈다22. Divide residual SS by n minus two after fitting two coefficients

절편과 기울기 두 독립 방향을 맞추면 잔차 공간 차원은 n−2입니다. 독립·평균 0·공통분산 선형 모형에서는 E[SSE]=(n−2)σ²이므로 s²=SSE/(n−2)가 불편한 오차분산 추정값입니다. n>2가 필요합니다.

s2=SSEn−2VC=Var⁡^classical(b^)VC=s2Sxx\begin{gathered}s^2=\frac{SSE}{n-2}\\V_C=\widehat{\operatorname{Var}}_{\rm classical}(\widehat b)\\V_C=\frac{s^2}{S_{xx}}\end{gathered}

기본 자료는 s²=(4/5)/3=4/15,기울기 추정 분산은 2/75,SE≈0.163299입니다. SSE/n은 훈련 평균제곱오차라는 다른 수치이며 여기의 분산 보정과 다릅니다.

정확한 직선에 모든 점이 놓여 SSE=0인 자료는 수치 적합이 가능해도 이 실습의 양의 잔차분산 피벗은 미정의입니다. 임의로 무한 t나 확정적 유의성을 넣지 않습니다.

A full-rank intercept-plus-slope fit uses two directions,leaving n−2 residual dimensions. Under zero-mean independent common-variance linear errors,E[SSE]=(n−2)σ²,so s² is unbiased when n>2.

s2=SSEn−2VC=Var⁡^classical(b^)VC=s2Sxx\begin{gathered}s^2=\frac{SSE}{n-2}\\V_C=\widehat{\operatorname{Var}}_{\rm classical}(\widehat b)\\V_C=\frac{s^2}{S_{xx}}\end{gathered}

The default gives s²=4/15,slope variance 2/75 and SE≈.163299. SSE/n is training mean squared error,a different denominator.

Perfect interpolation allows numerical fitting but leaves this lab's positive-residual-variance pivot undefined. It does not invent infinite t or certain significance.

학부 연결 · 선택Undergraduate bridge · optional

23. 정규 오차의 독립 투영이 고전 t 기준을 만든다23. Independent normal projections produce the classical t reference

고정 full-rank x, 서로 독립인 N(0,σ²),σ²>0 오차를 가정합니다. 기울기 오차는 표준화하면 정규이고, 잔차 제곱합/σ²은 χ²ₙ₋₂입니다. 맞춘 공간과 잔차 공간이 직교하며 정규 벡터이므로 둘은 독립입니다.

T=b^−b0s/Sxx,T∣H0∼tn−2,H0:b=b0,CI:b^ ±t1−α/2,n−2sSxx.\begin{aligned} T&=\frac{\widehat b-b_0}{s/\sqrt{S_{xx}}},\\ T\mid H_0&\sim t_{n-2},\qquad H_0:b=b_0,\\ CI&:\quad\widehat b \ \pm t_{1-\alpha/2,n-2}\frac{s}{\sqrt{S_{xx}}}. \end{aligned}

이 정확한 유한표본 주장은 정규·독립·공통분산·선형 평균 조건을 사용합니다. 표본 수가 5여도 모형이 맞으면 기준이 성립하고,3010이어도 의존·선택 문제가 저절로 없어지지는 않습니다. 임계값·p값은 수치 근사로 계산해 표시합니다.

Assume fixed full-rank x and independent N(0, σ²) errors with σ²>0. The standardized slope error is normal; SSE/σ² is χ²ₙ₋₂. Orthogonal fitted/residual normal coordinates make them independent.

T=b^−b0s/Sxx,T∣H0∼tn−2,H0:b=b0,CI:b^ ±t1−α/2,n−2sSxx.\begin{aligned} T&=\frac{\widehat b-b_0}{s/\sqrt{S_{xx}}},\\ T\mid H_0&\sim t_{n-2},\qquad H_0:b=b_0,\\ CI&:\quad\widehat b \ \pm t_{1-\alpha/2,n-2}\frac{s}{\sqrt{S_{xx}}}. \end{aligned}

The exact finite-sample claim uses all stated model conditions. It can hold at n=5 if the model is right; dependence and selection do not vanish automatically at n=3010. Displayed critical values and tails are numerical approximations.

기초Foundations

24. 실습 C: 기울기 표적과 분산 추정 기준을 바꾼다24. Lab C: change the slope null and variance reference

기본 자료에서 b₀=0,α=0.05를 넣으면 t≈4.89898, df=3, p≈0.0162766입니다. 고전 95% 기울기 구간은 약 [0.280309,1.319691]입니다. 원 기울기 0.8과 불확실성 척도를 함께 읽으세요.

HC1을 고르면 기울기 적합은 그대로이고 분산 추정과 참고 분포가 바뀝니다. 이 실습은 고전 t와 HC1 점근 정규를 구별해 표시합니다. HC1을 선택했다는 이유로 작은 표본에서 정확 검정이 되거나 인과 문제가 사라지는 것은 아닙니다.

모형의 유한 구간 끝점이 일반 숫자 표시 범위를 넘을 수 있습니다. 이 경우 ‘표시 범위 초과’로 구별하며 수학적 무한구간이나 피벗 미정의라고 부르지 않습니다.

At b₀=0 and α=.05, the default gives t≈4.89898, df=3, p≈.0162766 and classical 95% slope CI about [.280309,1.319691]. Read slope .8 alongside its uncertainty.

Selecting HC1 preserves fitted coefficients but changes variance estimation and reference calibration. The lab distinguishes classical t from HC1 asymptotic normal. HC1 is not an exact small-sample or causal guarantee.

A mathematically finite interval can exceed ordinary numeric endpoint display. “Display range exceeded” is distinct from an infinite mathematical interval or undefined pivot.

학부 연결 · 선택Undergraduate bridge · optional

25. 이분산에서는 오차별 분산이 다른 가중치로 들어간다25. Heteroskedastic errors contribute through individual weighted variances

오차가 독립·평균 0이지만 Var(εᵢ)=σᵢ²로 다르면 기울기의 가중합 공식은 유지됩니다. 분산은 Σwᵢ²σᵢ²이므로 일반적으로 공통 s²/Sxx로 요약되지 않습니다.

Var⁡(b^)=∑i(xi−x‾)2σi2Sxx2.\operatorname{Var}(\widehat b) =\frac{\sum_i(x_i-\overline x)^2\sigma_i^2}{S_{xx}^2}.

평균 모형이 맞는다면 이분산 자체가 OLS 기울기 불편성을 깨뜨리는 것은 아닙니다. 그러나 잘못된 SE는 구간·검정의 오차를 바꿀 수 있습니다. ‘불편한 계수’와 ‘타당한 불확실성 추론’을 구별합니다.

관측 잔차 제곱으로 미지의 σᵢ²를 대체하는 방법은 다음의 일관성 조건을 요구합니다. 군집 의존에서는 서로 다른 오차의 교차 곱이 빠져 있으므로 개별 HC만으로 충분하지 않습니다.

Independent zero-mean errors may have different σᵢ². The weighted-error slope expression remains valid, but its variance generally is not a common σ²/Sxx.

Var⁡(b^)=∑i(xi−x‾)2σi2Sxx2.\operatorname{Var}(\widehat b) =\frac{\sum_i(x_i-\overline x)^2\sigma_i^2}{S_{xx}^2}.

With the correct mean, heteroskedasticity alone does not destroy OLS unbiasedness. It can invalidate an inappropriate SE and hence interval/test calibration. Coefficient unbiasedness and valid uncertainty are separate.

Replacing unknown variances by residual squares requires consistency conditions. With clustered dependence, cross-error products also matter, so individual HC is not automatically sufficient.

선택 심화Optional extension

26. HC1의 유한 보정과 점근 주장을 구별한다26. Separate the HC1 correction from its asymptotic justification

이 장의 HC1 기울기 분산은 HC0 잔차 제곱합에 n/(n−2)를 곱한 정의입니다. 절편과 기울기를 갖는 두 모수 모형에서 다음과 같습니다. 이 인자 하나가 유한표본의 정확 불편성이나 정확 t를 보장하지는 않습니다.

V^HC1(b^)=nn−2∑i(xi−x‾)2ei2Sxx2,V^HC1(β^)=nn−2(X⊤X)−1⋅X⊤diag⁡(ei2)X(X⊤X)−1.\begin{aligned} \widehat V_{\rm HC1}(\widehat b) &=\frac{n}{n-2} \frac{\sum_i(x_i-\overline x)^2e_i^2}{S_{xx}^2},\\ \widehat V_{\rm HC1}(\widehat\beta) &=\frac{n}{n-2}(X^\top X)^{-1}\\ &\quad\cdot X^\top\operatorname{diag}(e_i^2)X (X^\top X)^{-1}. \end{aligned}

많은 관측에서 적절한 독립·모멘트 조건, 안정된 비퇴화 설계, 특정 소수 관측이 지배하지 않는 조건이 있을 때 sandwich 일관성과 점근 정규 추론을 논의합니다. 이 장 실습은 HC1 SE에 정규 임계값을 쓰는 점근 참고 계산입니다. 자동 유효성 인증이 아닙니다.

평균 모형이 잘못되었거나 표집이 선택되었을 때 무엇의 선형투영을 추정하는지 먼저 재정의해야 합니다. HC1은 곡선 평균을 직선으로 바꾸거나 누락된 교란을 제거하지 않습니다.

Here HC1 multiplies the HC0 residual-square sandwich by n/(n−2). That finite factor alone guarantees neither exact unbiasedness nor an exact t pivot.

V^HC1(b^)=nn−2∑i(xi−x‾)2ei2Sxx2,V^HC1(β^)=nn−2(X⊤X)−1⋅X⊤diag⁡(ei2)X(X⊤X)−1.\begin{aligned} \widehat V_{\rm HC1}(\widehat b) &=\frac{n}{n-2} \frac{\sum_i(x_i-\overline x)^2e_i^2}{S_{xx}^2},\\ \widehat V_{\rm HC1}(\widehat\beta) &=\frac{n}{n-2}(X^\top X)^{-1}\\ &\quad\cdot X^\top\operatorname{diag}(e_i^2)X (X^\top X)^{-1}. \end{aligned}

Sandwich consistency and asymptotic normality require suitable independence, moments, nondegenerate stable design and control of dominating observations. Our HC1 normal critical value is an asymptotic reference, not automatic certification.

With misspecified means or selected sampling, first define the projection target. HC1 does not linearize a curved mean or remove omitted confounding.

학부 연결 · 선택Undergraduate bridge · optional

27. 누락 변수는 같은 산점도에 다른 설명을 허용한다27. Omitted variables allow different explanations of the same scatter

가상 모형 Y=βX+γZ+u에서 E[u|X, Z]=0이라도 Z를 빼고 X만 회귀하면 다른 선형 요약을 얻을 수 있습니다. 제곱적분과 Var(X)>0 아래 단순 기울기는 β+γCov(X, Z)/Var(X)입니다.

bsimple=β+γ Cov⁡(X,Z)Var⁡(X).b_{\rm simple} =\beta+\gamma\,\frac{\operatorname{Cov}(X,Z)} {\operatorname{Var}(X)}.

예를 들어 β=0,γ=2, Cov(X, Z)/Var(X)=1이면 단순 기울기 2가 나옵니다. X의 직접 계수 0과 모순이 아닙니다. 두 변수가 같은 원인 Z와 함께 움직일 수 있기 때문입니다.

관측 기울기를 인과로 해석하려면 배정·잠재결과·식별 가정과 연구 설계가 필요합니다. 변수를 많이 넣는 것만으로 항상 해결되는 것도 아니며 처치 뒤 변수·선택 조건에 주의해야 합니다. 계량경제학 과정에서 더 다룹니다.

In hypothetical Y=βX+γZ+u with E[u|X, Z]=0, omitting Z can change the simple linear slope. Under square integrability and Var(X)>0, it becomes the displayed expression.

bsimple=β+γ Cov⁡(X,Z)Var⁡(X).b_{\rm simple} =\beta+\gamma\,\frac{\operatorname{Cov}(X,Z)} {\operatorname{Var}(X)}.

If β=0,γ=2 and Cov(X, Z)/Var(X)=1, the simple slope is 2 despite zero direct coefficient. Co-movement with Z explains the difference.

Causal interpretation needs design and identification assumptions, not merely a fitted line or many controls. Post-treatment and selection variables can introduce further problems; econometrics develops these questions.

기초Foundations

28. 좌표를 바꿔도 적합값을 일관되게 변환한다28. Coordinate changes must transform coefficients and fits consistently

x*=cx+d, y*=ay+b, a, c≠0로 바꾸면 새 기울기는 (a/c)b̂입니다. x만 10000으로 나누면 기울기는 10000배가 됩니다. 이는 효과가 새로 커진 것이 아니라 x 한 단위의 정의가 달라진 것입니다.

x−x̄로 중심화하면 기울기는 같고 절편은 ȳ가 됩니다. 원절편과 기울기는 서로 상관될 수 있지만 중심화 절편과 기울기는 공통분산 고정 설계에서 공분산 0입니다. 좌표를 잘 고르면 계산과 해석이 편해집니다.

국가의 GDP 단위를 바꾸어 기대수명 회귀를 그릴 때 원단위를 명시합니다. 개인의 로그 임금은 단순 화폐 환산과 다릅니다. 로그 평균 반응을 지수화한 값은 산술 수준 평균과 일반적으로 다릅니다.

For x*=cx+d and y*=ay+b with nonzero a, c, the new slope is (a/c) b̂. Dividing x by 10000 multiplies slope by 10000, a coordinate change rather than a new effect.

Centering x at x̄ leaves slope unchanged and makes the intercept ȳ. Under fixed-design common variance, the centered intercept and slope have zero covariance, unlike raw coefficients generally.

Label GDP units explicitly. Logged wages are not just another currency unit; exponentiating a mean log response generally does not recover an arithmetic level mean.

기초Foundations

29. 주어진 x₀의 평균 반응은 두 계수의 조합이다29. The mean response at a specified predictor combines both coefficients

주어진 x₀에서 평균 반응을 m₀=a+bx₀라 합시다. 추정값은 â+b̂x₀입니다. 중심화 표현 ȳ+b̂(x₀−x̄)를 쓰면 분산이 더 잘 보입니다. 공통분산·독립 고정 설계에서 ȳ와 b̂는 공분산 0입니다.

m^0=Y‾+b^(x0−x‾),Var⁡(m^0)=σ2{1n+(x0−x‾)2Sxx}.\begin{aligned} \widehat m_0&=\overline Y+\widehat b(x_0-\overline x),\\ \operatorname{Var}(\widehat m_0) &=\sigma^2\left\{\frac1n+ \frac{(x_0-\overline x)^2}{S_{xx}}\right\}. \end{aligned}

평균 x에서 첫 항만 남고 가장 작은 분산입니다. x₀가 멀어질수록 기울기 불확실성이 더 크게 작용합니다. 이 공식은 평균 함수가 참으로 선형이라는 모형 아래입니다. 직선의 계산 가능 범위와 모형이 설득력 있는 범위를 구별합니다.

At a specified x₀, the mean is m₀=a+bx₀ and its estimate is â+b̂x₀. Centering gives Ȳ+b̂(x₀−x̄). Under independent common-variance fixed design,Ȳ and b̂ have zero covariance.

m^0=Y‾+b^(x0−x‾),Var⁡(m^0)=σ2{1n+(x0−x‾)2Sxx}.\begin{aligned} \widehat m_0&=\overline Y+\widehat b(x_0-\overline x),\\ \operatorname{Var}(\widehat m_0) &=\sigma^2\left\{\frac1n+ \frac{(x_0-\overline x)^2}{S_{xx}}\right\}. \end{aligned}

Variance is smallest at x̄ and grows as the query moves away. The formula assumes a genuinely linear mean. Numerical evaluability is not substantive model validity.

기초Foundations

30. 평균 반응 구간은 한 지점의 고정 표적을 감싼다30. A mean-response interval covers a fixed target at one point

앞의 정규 고정 설계 모형에서 미지의 σ²를 s²로 바꾸고 tₙ₋₂를 사용하면 m(x₀)의 점별 구간을 얻습니다. x₀를 사전에 고정한 반복 실험에서의 보장입니다.

h0=1n+(x0−x‾)2Sxx,CImean: m^0±t1−α/2,n−2sh0.\begin{aligned} h_0&=\frac1n+\frac{(x_0-\overline x)^2}{S_{xx}},\\ CI_{\rm mean}&:\ \widehat m_0\pm t_{1-\alpha/2,n-2}s\sqrt{h_0}. \end{aligned}

기본 자료에서 x₀=2이면 h₀=1/5, 평균 추정 분산은 4/75입니다. 95% 구간은 약 [1.865046,3.334954]입니다. 이것은 그 x에서 평균 반응의 구간이지 대부분의 개별 y가 들어가는 구간이 아닙니다.

모든 x 지점의 95% 점별 구간을 한 그림에 그렸다고 직선 전체를 동시에 95%로 감싸는 띠가 되는 것은 아닙니다. 동시 추론은 별도 보정과 표적이 필요합니다.

Under the preceding normal fixed-design model, substitute s² and use tₙ₋₂ for a pointwise interval for m(x₀). Coverage concerns repetition at a prespecified point.

h0=1n+(x0−x‾)2Sxx,CImean: m^0±t1−α/2,n−2sh0.\begin{aligned} h_0&=\frac1n+\frac{(x_0-\overline x)^2}{S_{xx}},\\ CI_{\rm mean}&:\ \widehat m_0\pm t_{1-\alpha/2,n-2}s\sqrt{h_0}. \end{aligned}

At default x₀=2, h₀=1/5 and mean-estimation variance is 4/75. The 95% CI is about [1.865046,3.334954], for a mean rather than most individual responses.

Drawing pointwise 95% intervals at many x values does not create a simultaneous 95% band for the entire function.

기초Foundations

31. 새 관측의 구간에는 아직 보지 못한 오차가 더해진다31. A new-response interval adds a not-yet-observed error

새 Y₀=a+bx₀+ε₀가 있고 ε₀는 모든 훈련 오차와 독립이며 같은 N(0,σ²) 법칙을 가진다고 합시다. 예측 오차는 ε₀−(m̂₀−m₀)여서 두 독립 성분의 분산이 합쳐집니다.

Var⁡(Y0−m^0)=σ2(1+h0)c=t1−α/2,n−2SEnew=s1+h0PInew: m^0±c SEnew\begin{gathered}\operatorname{Var}(Y_0-\widehat m_0)=\sigma^2(1+h_0)\\c=t_{1-\alpha/2,n-2}\\SE_{\rm new}=s\sqrt{1+h_0}\\PI_{\rm new}:\ \widehat m_0\pm c\,SE_{\rm new}\end{gathered}

기본 x₀=2에서는 추정 예측 분산이 8/25이고 95% PI는 약 [0.799737,4.400263]입니다. 평균 CI보다 넓은 이유는 새 관측 자체의 변동 σ²가 추가되기 때문입니다. 훈련 잔차의 분산과 새 관측 예측 오차의 분산은 같지 않습니다.

미래의 분포가 바뀌거나 새 오차가 훈련과 의존하면 이 보장은 달라집니다. ‘prediction’이라는 출력 이름이 실제 미래 예측 검증을 대신하지 않습니다.

Assume new Y₀=a+bx₀+ε₀, with ε₀ independent of all training errors and having the same N(0, σ²) law. Prediction error combines new noise with mean-estimation error.

Var⁡(Y0−m^0)=σ2(1+h0)c=t1−α/2,n−2SEnew=s1+h0PInew: m^0±c SEnew\begin{gathered}\operatorname{Var}(Y_0-\widehat m_0)=\sigma^2(1+h_0)\\c=t_{1-\alpha/2,n-2}\\SE_{\rm new}=s\sqrt{1+h_0}\\PI_{\rm new}:\ \widehat m_0\pm c\,SE_{\rm new}\end{gathered}

At default x₀=2, the estimated variance is 8/25 and the 95% PI about [.799737,4.400263]. It is wider than the mean CI because new-response variation is added. Training residual variance differs from new prediction-error variance.

Distribution shifts or dependence with training invalidate the stated guarantee. A software “prediction” label is not validation of future predictive performance.

기초Foundations

32. 실습 D: 평균과 새 관측의 폭을 함께 비교한다32. Lab D: compare mean and new-response widths

x₀를 평균 x 근처에서 바깥쪽으로 이동해 두 구간을 비교하세요. 같은 중심 적합값을 사용하지만 분산 식에 1이 더해지는지 다릅니다. α를 바꾸면 임계값이, 자료를 바꾸면 적합과 잔차분산도 함께 바뀝니다.

관측 x 범위를 벗어나면 외삽 표시를 읽으세요. 수학식으로는 계산되어도 그 구간에 같은 직선·오차 모형을 적용할 근거는 별도입니다. 이 실습은 점별 고전 구간이며 HC1 기울기 SE를 그대로 새 관측 PI에 끼워 넣는 방법이 아닙니다.

Move x₀ from the predictor mean toward the edges and compare widths. Centers agree, but the new-response variance includes an extra one. Changing α changes the critical value; editing data also changes fit and residual variance.

An extrapolation marker flags queries outside observed x range. Arithmetic availability does not justify extending the mean/error model. These are pointwise classical intervals, not new-response intervals obtained by inserting an HC1 slope SE.

기초Foundations

33. 관측 범위 밖의 계산은 새로운 실측이 아니다33. A calculation outside observed support is not a new observation

x가 0부터 4까지인 가상 자료에서 x₀=100을 넣어도 직선식은 값을 돌려줍니다. 그러나 그 지점에서 선형 평균과 같은 오차분산이 유지된다는 근거는 자료에 없습니다. 멀리 갈수록 평균 구간 폭이 커져도, 모형 오차 자체를 모두 반영한 것은 아닙니다.

관측 범위 안도 자동 안전하지는 않습니다. 점이 없는 빈 구간·다른 집단·다른 시점에서는 같은 범위의 숫자라도 다른 자료 생성일 수 있습니다. 숫자 최소/최대 확인은 시작 점검입니다.

미래 예측을 평가하려면 목적에 맞게 나눈 새 단위·미래 시점 자료에서 오차를 확인해야 합니다. 훈련 잔차와 고전 PI만 제시하고 검증된 예측 서비스라고 부르지 않습니다.

A line fitted for x from zero to four still returns a number at x₀=100. The records do not verify the same linear mean or noise there. Increasing interval width does not account for every possible model error.

Even an in-range query can lie in a data gap or another population/time regime. Checking numerical min/max is an initial diagnostic, not a universal safety certificate.

Evaluate prediction on appropriately held-out new units or future times. Training residuals and classical working intervals alone are not validated predictive performance.

기초Foundations

34. leverage는 응답과 무관한 x 배치의 영향 위치다34. Leverage measures predictor-design geometry independently of responses

절편 있는 단순 회귀의 leverage hᵢ는 1/n+(xᵢ−x̄)²/Sxx입니다. 평균 x에서 가장 작고, 멀리 떨어진 x에서 큽니다. y를 바꾸지 않아도 x 위치만으로 결정됩니다.

hi=1n+(xi−x‾)2Sxx,1n≤hi≤1,∑ihi=2.\begin{aligned} h_i&=\frac1n+\frac{(x_i-\overline x)^2}{S_{xx}},\\ \frac1n&\le h_i\le1,\qquad\sum_i h_i=2. \end{aligned}

기본 x=(0,1,2,3,4)는 leverage (0.6,0.3,0.2,0.3,0.6)을 줍니다. 높은 leverage 점은 직선 방향을 바꿀 잠재력이 있지만, 항상 실제로 많이 바꾸는 것은 아닙니다. 응답이 현재 추세와 잘 맞으면 잔차가 작을 수 있습니다.

합 2는 두 독립 계수 방향의 투영 차원입니다. 높은 leverage를 입력 오류나 제거 지시로 읽지 않습니다.

For simple intercept regression, hᵢ=1/n+(xᵢ−x̄)²/Sxx. It is smallest at mean x and larger farther away, depending on x rather than y.

hi=1n+(xi−x‾)2Sxx,1n≤hi≤1,∑ihi=2.\begin{aligned} h_i&=\frac1n+\frac{(x_i-\overline x)^2}{S_{xx}},\\ \frac1n&\le h_i\le1,\qquad\sum_i h_i=2. \end{aligned}

Default leverage values are (.6,.3,.2,.3,.6). High leverage gives potential to change the line, but a response aligned with the trend can have a small residual and limited realized influence.

The sum two equals the fitted-space rank. Leverage is neither proof of recording error nor an instruction to remove a point.

학부 연결 · 선택Undergraduate bridge · optional

35. 맞춘 뒤 잔차들은 원래 오차와 같은 독립 표본이 아니다35. Fitted residuals are not another independent sample of original errors

설계행렬 X와 직교 투영 H=X(XᵀX)⁻¹Xᵀ를 쓰면 적합값은 HY, 잔차는 (I−H)Y입니다. 독립 공통분산 오차 모형에서도 잔차 공분산은 σ²(I−H)입니다.

Var⁡(ei)=σ2(1−hi),Cov⁡(ei,ej)=−σ2Hij(i≠j).\begin{aligned} \operatorname{Var}(e_i)&=\sigma^2(1-h_i),\\ \operatorname{Cov}(e_i,e_j)&=-\sigma^2H_{ij} \quad(i\ne j). \end{aligned}

높은 leverage 관측의 훈련 잔차는 오히려 작은 분산을 가집니다. 이를 무조건 ‘더 잘 예측했다’고 읽으면 직선이 그 관측을 따라간 효과를 놓칩니다. 잔차 합 0이라는 제한만 보아도 잔차가 자유로운 iid 표본은 아님을 알 수 있습니다.

잔차 그림은 모형의 곡률·퍼짐·순서 패턴을 찾는 도구입니다. 제한된 잔차들에 단순 검정을 적용할 때 원오차와 동일한 자유도를 부여하지 않습니다.

With H=X(XᵀX)⁻¹Xᵀ, fits are HY and residuals (I−H) Y. Even independent common-variance errors produce residual covariance σ²(I−H).

Var⁡(ei)=σ2(1−hi),Cov⁡(ei,ej)=−σ2Hij(i≠j).\begin{aligned} \operatorname{Var}(e_i)&=\sigma^2(1-h_i),\\ \operatorname{Cov}(e_i,e_j)&=-\sigma^2H_{ij} \quad(i\ne j). \end{aligned}

High-leverage records have smaller training-residual variance. Calling that automatically better prediction misses fitting-to-the-point effects. The zero residual-sum constraint already shows that residuals are not a free iid sample.

Residual plots diagnose curvature, spread and order patterns. Their fitting constraints matter when applying additional statistical tests.

기초Foundations

36. Cook 거리는 잔차와 leverage를 합쳐 맞춤 민감도를 본다36. Cook distance combines residual size and leverage to describe fit sensitivity

관측 i 하나를 가정상 빼고 같은 모든 x에서의 적합값이 얼마나 달라지는지 생각합니다. 두 모수 모형의 Cook 거리는 그 제곱 변화 합을 2s²로 표준화한 값입니다. hᵢ<1, s²>0일 때 닫힌 식으로 계산할 수 있습니다.

Di=∑j(y^j−y^j,(i))22s2=ei22s2hi(1−hi)2.\begin{aligned} D_i&=\frac{\sum_j(\widehat y_j-\widehat y_{j,(i)})^2}{2s^2}\\ &=\frac{e_i^2}{2s^2}\frac{h_i}{(1-h_i)^2}. \end{aligned}

큰 잔차와 큰 leverage가 함께 있을 때 영향이 커질 수 있습니다. 그러나 ‘D>어떤 값이면 반드시 삭제’라는 보편 규칙은 아닙니다. 기록의 정확성·질문·선택·모형을 함께 검토해야 합니다.

hᵢ=1이면 그 관측 삭제가 설계 랭크를 바꿀 수 있어 이 식의 분모가 0입니다. 실습은 미정의로 표시하며 임의의 Cook 숫자를 만들지 않습니다.

Hypothetically delete record i and compare fits at all original x values. Cook distance scales the squared fit change by 2s² for this two-parameter model. Its closed form requires hᵢ<1 and s²>0.

Di=∑j(y^j−y^j,(i))22s2=ei22s2hi(1−hi)2.\begin{aligned} D_i&=\frac{\sum_j(\widehat y_j-\widehat y_{j,(i)})^2}{2s^2}\\ &=\frac{e_i^2}{2s^2}\frac{h_i}{(1-h_i)^2}. \end{aligned}

Large residuals combined with high leverage can yield strong influence. A generic threshold is not a universal deletion rule; verify the record, question, selection and model.

At hᵢ=1, deletion can change design rank and the formula denominator vanishes. The lab reports undefined rather than inventing a Cook value.

학부 연결 · 선택Undergraduate bridge · optional

37. 한 행 삭제의 변화는 원자료와 나란히 보관한다37. Keep one-record deletion comparisons beside the original fit

hᵢ<1이고 삭제 후 설계도 full rank이면 기울기 변화는 다음 식입니다. 이는 가정상 삭제 민감도이며 원기록이 틀렸다는 판정은 아닙니다.

b^(i)−b^=−(xi−x‾)eiSxx(1−hi).\widehat b_{(i)}-\widehat b =-\frac{(x_i-\overline x)e_i}{S_{xx}(1-h_i)}.

기본 자료의 마지막 점 x=4, y=4는 잔차 −1/5, h=3/5입니다. 삭제하면 기울기 변화는 −[2(−1/5)]/[10(2/5)]=1/10이므로 0.8에서 0.9로 바뀝니다. ‘끝점 삭제’가 항상 기울기를 줄이는 것은 아닙니다.

원자료·원 적합·선택 키·삭제 후 포함 수를 모두 남기세요. 불완전짝으로 이미 제외된 행을 골라도 새 적합 변화가 생긴 것으로 표시하지 않습니다. 여러 삭제를 탐색해 마음에 드는 결과만 보고하면 선택 문제가 커집니다.

If hᵢ<1 and deletion preserves full rank, the slope change has the following form. It describes hypothetical sensitivity rather than proving the record wrong.

b^(i)−b^=−(xi−x‾)eiSxx(1−hi).\widehat b_{(i)}-\widehat b =-\frac{(x_i-\overline x)e_i}{S_{xx}(1-h_i)}.

The default last point x=4, y=4 has residual −1/5 and leverage 3/5. Deletion changes slope by 1/10, from .8 to .9. Removing an endpoint does not always reduce slope.

Keep original records, fit, selected key and deletion count. Selecting an already incomplete pair does not create a new fitted change. Reporting only favorable deletions introduces selection.

기초Foundations

38. 실습 E: 영향이 큰 점과 잘못된 점을 구별한다38. Lab E: distinguish influential from erroneous records

잔차·leverage·Cook를 함께 보며 한 입력 행을 선택해 가정상 삭제 결과를 비교하세요. 첫 계산은 모든 점의 진단을 닫힌 식으로 만들고, 삭제 비교는 고른 한 행만 재적합합니다. 원래 수치와 적합은 유지됩니다.

가까운 x에서 y만 크게 바꾼 점과 멀리 떨어진 x의 점은 서로 다른 방식으로 영향을 줍니다. 원행 위치와 완전짝으로 남은 순번이 다를 수 있으므로 표시 키를 확인합니다. 진단의 목적은 근거를 찾아 질문을 다시 검토하는 것이지 유의한 기울기가 나올 때까지 점을 없애는 것이 아닙니다.

Inspect residuals, leverage and Cook, then select one typed row for a hypothetical deletion fit. All diagnostics use closed forms from one fit; only the selected deletion is refitted. Original values and fit remain available.

A large y departure near mean x differs from a point far out in predictor space. Check source position versus retained-pair order. Diagnostics should motivate verification and model assessment, not deletion until a favorable significance result appears.

기초Foundations

39. 곡률·부채꼴·시간 패턴은 서로 다른 질문을 남긴다39. Curvature, fanning and time patterns suggest different problems

잔차가 x에 따라 U자로 남으면 선형 평균이 중요한 곡률을 놓쳤을 수 있습니다. 퍼짐이 x와 함께 커지는 부채꼴은 이분산의 단서지만, 잘못된 평균 함수가 같은 모양을 만들 수도 있습니다. 원산점도와 조건별 평균을 함께 봅니다.

시간 순서나 집단별로 잔차가 오래 같은 부호를 유지하면 독립 가정도 점검합니다. 단순 HC1은 이런 오차 간 공분산을 일반적으로 보정하지 않습니다. 적절한 시계열·군집 모형이 필요한지 질문합니다.

그림에서 패턴이 잘 안 보인다고 모든 조건이 증명되는 것은 아닙니다. 관측 수·설계 범위·기록 순서의 의미에 한계가 있습니다. 소프트웨어의 행 순서를 실제 시간 순서라고 추가하지 않습니다.

A U-shaped residual pattern can signal missing mean curvature. Fanning can suggest heteroskedasticity, but a wrong mean function can also create it. Inspect original scatter and conditional summaries together.

Persistent residual signs in time or groups invite dependence checks. Simple HC1 generally does not account for cross-error covariance; consider an appropriate time-series or cluster model.

No visible pattern proves every assumption. Sample size, design range and meaningful record order limit diagnosis. Software row order is not automatically chronological time.

기초Foundations

40. 결측·절단·선택은 추정 대상과 설명을 바꾼다40. Missingness, trimming and selection change the target and interpretation

완전짝 회귀는 가용 기록의 손실을 최소화합니다. 임금이 없는 사람을 0으로 채우면 가용 분석이 아니라 새 자료를 만든 것입니다. 그 사람의 x가 있어도 빠진 y는 알 수 없습니다.

결측이 X, Y와 관련될 수 있으므로 가용 집단의 기울기를 전체 모집단의 기울기라고 자동 부르지 않습니다. 원자료가 이미 절단한 로그 임금을 담는다면 그 출처 처리까지 남겨야 합니다. 정교한 SE는 이런 선택을 대신 식별하지 않습니다.

동일 수치 행 삭제도 관측 가중치를 바꿉니다. 제품 기록의 값이 같다는 이유만으로 같은 실험의 실수 복제라고 확인된 것은 아닙니다. 삭제 여부는 근거를 기록하고 민감도 분석으로 분리합니다.

Complete-pair regression minimizes loss for available records. Replacing missing wages by zero creates a different dataset; knowing x does not reveal missing y.

Selection can depend on X, Y, so the available-record slope is not automatically a full-population slope. Preserve source trimming of log wages. A sophisticated SE does not identify away selection.

Deleting identical numeric rows also changes weights. Equal product values do not prove mistaken duplicate experiments. Document any exclusion and separate it as sensitivity analysis.

선택 심화Optional extension

41. 다변량 회귀도 먼저 열 공간과 표적을 정한다41. Multiple regression begins with a design space and target

설계행렬 X의 각 열을 상수·설명 변수·제곱·상호작용 등으로 고르면 선형투영 문제를 확장할 수 있습니다. full column rank이면 β̂=(XᵀX)⁻¹Xᵀy입니다. 수치 계산에서는 역행렬을 직접 만들기보다 QR·SVD 같은 안정된 분해를 쓸 수 있습니다.

y^=Xβ^X⊤e=0Var⁡^classical(β^)=s2(X⊤X)−1\begin{gathered}\widehat y=X\widehat\beta\\X^\top e=0\\\widehat{\operatorname{Var}}_{\rm classical}(\widehat\beta)\\=s^2(X^\top X)^{-1}\end{gathered}

공분산 추정식에서는 p=rank(X),n>p,s²=SSE/(n−p)를 명시합니다. 올바른 선형 평균·독립 공통분산 모형의 분산 추정이며 정확 t에는 정규 조건이 더 필요합니다. n=p의 보간에서 계수를 구할 수 있어도 이 잔차분산 피벗은 정의되지 않습니다. 열이 종속이면 계수 비유일·추정 가능한 조합·정규화 목적을 나누어야 합니다.

설명 변수를 추가하면 훈련 SSE는 커지지 않지만 새 자료 성능·인과 식별이 자동 개선되지는 않습니다. 계량경제학·데이터 사이언스에서는 표적·선택·검증 설계를 더 깊게 다룹니다.

Columns for an intercept,predictors,powers or interactions extend the projection. Full column rank gives β̂=(XᵀX)⁻¹Xᵀy. Numerical implementations can use stable QR or SVD instead of explicitly forming an inverse.

y^=Xβ^X⊤e=0Var⁡^classical(β^)=s2(X⊤X)−1\begin{gathered}\widehat y=X\widehat\beta\\X^\top e=0\\\widehat{\operatorname{Var}}_{\rm classical}(\widehat\beta)\\=s^2(X^\top X)^{-1}\end{gathered}

For the covariance estimate,write p=rank(X),n>p and s²=SSE/(n−p). A correct linear mean and independent common-variance errors are required;exact t adds normality. Coefficients can be determined at n=p while this residual-variance pivot is undefined. Dependent columns require distinguishing nonunique coefficients,estimable combinations and regularization.

More columns cannot increase training SSE but need not improve new-data performance or causal identification. Econometrics and data science develop target,selection and validation design.

기초Foundations

42. 실제 국가: GDP와 기간 기대수명의 선형 요약42. Actual countries: GDP and period-life-expectancy projection

실제 World Bank 2024년 16개 국가의 가용 쌍을 동일 국가 가중으로 사용합니다. x=1인당 실질 GDP(2015년 불변 USD)÷10000, y=기간 기대수명(년)입니다. 기간 기대수명은 당시 연령별 사망률을 유지한다는 집단 지표이며 한 개인의 실제 수명 기록이 아닙니다.

적합 직선은 대략 ŷ=72.970869+1.739588x이고 R²≈0.615395입니다. 고전 기울기 SE≈0.367547, HC1 SE≈0.387195입니다. 고전 t의 자유도는 14, 참고 양쪽 p≈0.000320589,95% 기울기 구간은 약 [0.951278,2.527899]입니다.

국가 16개를 세계의 무작위 표본이라 확인하지 않았으며 인구 가중도 아닙니다. GDP를 늘리는 정책이 개인의 수명을 해당 기울기만큼 바꾼다는 인과 해석은 식별되지 않습니다. 국가 키와 원좌표·잔차·leverage를 함께 봅니다.

Use 16 available World Bank country pairs for 2024 with equal country weights. x is GDP per capita in constant 2015 USD divided by 10000; y is period life expectancy in years, a population mortality-rate indicator rather than one person's observed lifespan.

The fitted line is roughly ŷ=72.970869+1.739588x with R²≈.615395. Classical slope SE≈.367547 and HC1 SE≈.387195. Classical df=14, reference two-sided p≈.000320589 and 95% slope CI about [.951278,2.527899].

These 16 countries were not verified as a random world sample and are not population-weighted. A GDP policy effect on individual lifespan is not identified. Retain source keys, coordinates, residuals and leverage.

기초Foundations

43. 실제 사람: 학력 연수와 가용 로그 임금을 연결한다43. Actual people: schooling and available source log wages

Card의 3613개 남성 기록 중 원 로그 임금이 있는 3010개 완전짝을 사용합니다. 603개 결측을 유지하고 채우지 않습니다. x는 보고 학력 연수, y는 출처의 시간당 임금 로그입니다. 학위 여부나 현재 화폐 수준을 새로 추가하지 않습니다.

적합 직선은 약 ŷ=5.570882+0.05209424x, R²≈0.09873652입니다. 고전 SE≈0.00286971, HC1 SE≈0.00290688입니다. 고전 참고 구간은 약 [0.04646745,0.05772103], df=3008입니다. 같은 x별 관측 평균은 이 직선을 모두 정확히 지나지 않습니다.

기울기는 로그 단위/학력 연수의 선형 요약입니다. exp(0.05209424)−1은 적합 기하 중심의 1년 대비 비율로 계산할 수 있지만, 산술 평균 임금의 인과 수익률은 아닙니다. 교육 선택·출처 절단·결측·누락 변수는 남습니다.

Use 3010 complete pairs with source log wages among 3613 male Card records, preserving 603 missing logs. x is reported schooling years; y is source log hourly wage. Do not add unverified degree labels or current currency levels.

The line is about ŷ=5.570882+.05209424x with R²≈.09873652. Classical SE≈.00286971, HC1 SE≈.00290688, classical df=3008 and working CI about [.04646745,.05772103]. Same-x observed means do not all lie exactly on the line.

The slope is a log-unit-per-schooling-year summary. exp(.05209424)−1 describes a fitted geometric-center contrast, not an identified causal arithmetic-mean wage return. Selection, trimming, missingness and omitted variables remain.

기초Foundations

44. 실제 제품: 순서형 품질 점수에 선택한 제곱손실을 적용한다44. Actual products: apply a chosen squared loss to ordinal quality scores

실제 포르투갈 레드와인 1599개 제품·실험실 기록에서 x는 알코올 부피백분율, y는 전문가 품질 점수입니다. 품질은 순서형 점수이며 이 수업은 이를 숫자로 놓은 제곱손실을 명시적으로 선택합니다. 특정 기업의 가격·매출·생산 배치를 식별한 자료가 아닙니다.

전체 수치 열이 서로 다른 행은 1359개, 추가 동일 수치 행은 240개지만 모두 보존합니다. 적합은 약 ŷ=1.874975+0.3608418x, R²≈0.2267344입니다. 고전 SE≈0.0166752, HC1 SE≈0.0180285입니다. 같은 보고 알코올 값의 평균 점수와 직선을 함께 비교합니다.

알코올 1%p 증가와 연관된 적합 점수 변화이지, 알코올을 늘리는 개입이 품질·가격을 이만큼 높인다는 인과 주장으로 바꾸지 않습니다. 생산 배치 독립·점수 간 등간성·외삽 타당성도 자동 확인되지 않습니다.

Use 1599 actual Portuguese red-wine product/laboratory records:x is alcohol percentage by volume and y an expert quality score. Quality is ordinal; the lesson explicitly chooses numerical squared loss. The data do not identify a company's prices, sales or production batches.

There are 1359 distinct full numeric rows and 240 additional identical ones, all retained. The line is about ŷ=1.874975+.3608418x with R²≈.2267344. Classical SE≈.0166752 and HC1 SE≈.0180285. Compare observed same-alcohol means with the line.

The slope describes score association per alcohol percentage point, not an identified intervention effect on quality or price. Batch independence, equal substantive score intervals and extrapolation validity are unverified.

기초Foundations

45. 실습 F: 실제 산점도와 두 SE·두 구간을 함께 읽는다45. Lab F: inspect actual scatter, two SEs and two intervals

실제 세 자료를 전환해 같은 원자료 키의 관측·적합·잔차·leverage·Cook를 확인하세요. 국가 x의 1단위는 실질 GDP/명 10000단위이고, 개인과 제품의 x 단위는 다릅니다. 점별 원자료는 해시가 남은 CSV에서 완전짝으로 추출했습니다.

고전 SE와 HC1 SE는 같은 적합 기울기의 다른 분산 참고입니다. 평균반응 CI와 새 응답 PI도 다른 표적입니다. 실제 자료에 정규·독립·공통분산이나 새 관측 법칙을 검증한 것이 아니므로 모두 작업 기준의 계산으로 읽습니다.

기본 쿼리는 관측 평균 x입니다. 다른 x를 넣으면 원범위와 외삽 표시를 함께 확인하세요. 가용 로그 임금의 포함 수·와인 동일 행 보존·국가 동일 가중을 잊지 않습니다.

Switch actual datasets and retain source keys while inspecting observations, fits, residuals, leverage and Cook. One country x unit is 10000 real GDP-per-capita units; person and product predictors use different units. Complete pairs come from hashed retained CSVs.

Classical and HC1 SEs are different variance references for the same slope. Mean-response CIs and new-response PIs target different quantities. Field normality, independence, common variance and future-response laws were not verified.

The default query is mean observed x. Check range and extrapolation for other queries, and retain wage availability, identical wine rows and equal-country weights.

기초Foundations

46. 국가·개인·제품 사례와 출처를 깊게 읽는다46. Read the country, person and product cases with sources

국가 사례 · 1인당 실질 GDP와 기대수명의 직선은 무엇을 설명하는가?

World Bank 고정 다운로드 사본의 2024년 16개 국가를 사용합니다. x는 1인당 실질 GDP를 10,000으로 나눈 값이며 단위는 1인당 1만 2015년 불변 미국달러입니다. PPP나 원화 금액이 아닙니다. y는 출생 시 기대수명으로, 해당 시점 사망률이 지속된다는 조건의 집단 지표이지 특정 개인의 수명 예측이 아닙니다. 국가별 가중치는 같고, 이 16개가 세계 모든 국가에서 뽑은 무작위 표본이라고 가정하지 않습니다.

실제 국가별 관측과 표본 내 직선 적합
국가GDPpc: 2015불변USD/인기대수명 년직선 적합 년잔차 년
Australia61,486.483.05183.667-0.616
Brazil9,566.776.02374.6351.388
Canada45,061.482.10880.8101.298
China13,119.178.01775.2532.764
Germany44,027.880.79380.6300.163
France39,683.482.98079.8743.106
United Kingdom47,901.081.38781.3040.083
Indonesia4,367.971.28873.731-2.443
India2,366.872.23573.383-1.148
Japan37,976.684.03679.5774.459
Korea, Rep.37,048.483.62979.4164.213
Mexico10,284.075.26474.7600.504
Singapore68,129.783.34684.823-1.476
United States66,856.578.89084.601-5.711
Viet Nam4,012.574.73673.6691.067
South Africa5,715.566.31273.965-7.653
Q(a,b)=∑i(yi−a−bxi)2(a^,b^)=arg⁡min⁡a,bQ(a,b)Sxy=∑i(xi−x‾)(yi−y‾)Sxx=∑i(xi−x‾)2b^=Sxy/Sxxa^=y‾−b^x‾\begin{gathered}Q(a,b)=\sum_i(y_i-a-bx_i)^2\\(\widehat a,\widehat b)=\arg\min_{a,b}Q(a,b)\\S_{xy}=\sum_i(x_i-\overline x)(y_i-\overline y)\\S_{xx}=\sum_i(x_i-\overline x)^2\\\widehat b=S_{xy}/S_{xx}\\\widehat a=\overline y-\widehat b\overline x\end{gathered}

계산한 직선은 ŷ≈72.970869 + 1.739588x입니다. 기울기의 단위는 “1인당 실질 GDP 1만 달러 차이당 기대수명 년 차이”입니다. 같은 국가를 관측한 위치에서 y−ŷ가 세로 잔차이며 산점도의 최단 수직거리와 다릅니다. OLS는 이 자료에서 선택한 직선 중 세로 제곱잔차 합을 최소화한 기술적 투영입니다. 참 조건부 평균 E[Y|X=x]가 반드시 이 직선이라는 결론이 아닙니다.

먼저 생각한 뒤 풀이 보기: 기울기만큼 GDP를 올리면 수명이 그만큼 늘어난다고 말해도 되나요?

아닙니다. 의료·제도·분배·역사·측정 차이 등이 함께 변할 수 있습니다. 국가 간 연관성을 개인의 소득 증가 효과로 옮기는 것도 생태학적 오류입니다. 원인 질문에는 별도의 식별 설계가 필요합니다. GDP의 단위를 달러에서 1만 달러로 바꾸면 계수 숫자는 바뀌지만 같은 국가의 적합값은 그대로입니다.

먼저 생각한 뒤 풀이 보기: 잔차가 크거나 x가 멀리 떨어진 국가를 삭제하면 되나요?

자동 삭제하지 않습니다. 지렛값 h는 x 위치의 특이함, 잔차는 y와 적합값의 차이, Cook 거리는 삭제 시 계수 영향의 진단량입니다. 같은 개념이 아닙니다. 이 표본의 Cook 거리 상위 세 관측은 USA (0.4866), ZAF (0.4739), JPN (0.0677)입니다. 먼저 자료·단위·질문을 확인하고 원자료 보존과 사전 기준에 따라 민감도 분석을 보고합니다.

개인 자료 사례 · 학력 연수별 관측 평균과 한 직선을 구별하기

1976년 Card 공개자료의 3613명 중 log 임금이 있는 3010명을 사용합니다. 교육 연수 x와 원자료가 절단 처리한 log 임금 y의 관계를 직선으로 요약합니다. 603개 결측을 0으로 채우지 않고, 전체 남성 모집단의 대표성이나 교육의 인과수익률을 주장하지 않습니다. 원시 시급 단위는 센트/시간이고, 원 조사 가중치는 사용하지 않습니다. 잠재경력·직업·지역 등을 통제하지 않은 단순 관측 회귀입니다.

실제 표본의 직선은 ŷ≈5.570882 + 0.052094×교육연수입니다. 각 교육연수에서의 실제 관측 평균도 따로 계산합니다. 어떤 연수의 관측 인원이 적으면 그 평균의 자료 기반도 작습니다. 아래 표와 그래프는 같은 x의 관측 평균이며 사람 한 명의 기록으로 보지 않습니다. 직선은 3010명 각각에 같은 가중치를 준 회귀이고, 연수별 평균들을 인원과 상관없이 똑같이 가중한 회귀가 아닙니다.

같은 교육연수에서의 관측 평균과 직선
실제 교육연수관측 n관측 평균 logOLS 직선값관측 평균−직선
116.214615.622980.59163
225.682505.675070.00743
335.370415.72717-0.35676
435.377875.77926-0.40139
5105.733675.83135-0.09768
6165.795905.88345-0.08755
7295.939105.935540.00356
8686.026585.987640.03894
9815.978626.03973-0.06111
101255.964246.09182-0.12758
111596.081236.14392-0.06269
129926.249026.196010.05301
132816.268006.248110.01989
142636.301396.300200.00118
151606.250556.35230-0.10174
164596.384556.40439-0.01984
171516.381996.45648-0.07449
182076.558376.508580.04979
∑ie^i=0∑ixie^i=0e^i=yi−a^−b^xiE[U∣X]=0은 별도의 명제입니다\begin{gathered}\sum_i\widehat e_i=0\\\sum_i x_i\widehat e_i=0\\\widehat e_i=y_i-\widehat a-\widehat b x_i\\E[U\mid X]=0\\\text{은 별도의 명제입니다}\end{gathered}
먼저 생각한 뒤 풀이 보기: 잔차 합과 x×잔차 합이 0이면 외생성이 증명되나요?

아닙니다. 두 표본 항등식은 절편이 있는 OLS의 최소화 과정이 강제로 만든 결과입니다. 모집단 오차 U의 조건부 평균이 0이라는 모형 가정이나 교육의 무작위 배정을 증명하지 않습니다. 직선이 잘못된 조건부 평균을 근사해도 이 표본 항등식은 성립합니다.

먼저 생각한 뒤 풀이 보기: log 기울기 b는 정확한 b×100% 임금 증가인가요?

단순 로그선형 비교에서 한 단위 x 차이에 대응하는 적합 기하 중심 비율은 exp(b)입니다. exp(b)−1과 b는 작은 b에서 가까울 뿐 같지는 않습니다. 여기 약 5.348%는 관측 직선의 기하 중심 비교이며 평균 시급 증가나 교육 개입의 효과가 아닙니다.

추론과 진단 · 같은 기울기에도 표준오차의 가정은 다르다

VC=Var⁡^classical(b^)VC=s^2/Sxxs^2=∑ie^i2n−2VH=Var⁡^HC1(b^)wi=(xi−x‾)2e^i2VH=nn−2∑iwiSxx2\begin{gathered}V_C=\widehat{\operatorname{Var}}_{\rm classical}(\widehat b)\\V_C=\widehat s^2/S_{xx}\\\widehat s^2=\frac{\sum_i\widehat e_i^2}{n-2}\\V_H=\widehat{\operatorname{Var}}_{HC1}(\widehat b)\\w_i=(x_i-\overline x)^2\widehat e_i^2\\V_H=\frac n{n-2}\frac{\sum_iw_i}{S_{xx}^2}\end{gathered}

고전적 기울기 SE≈0.00286971, HC1 SE≈0.00290688입니다. 고전적 정확 t 참조는 독립·정규·선형 조건부 평균·공통분산 같은 조건을 필요로 합니다. HC1은 독립 관측의 이분산 점근 추론을 위한 다른 분산 추정량이며, 군집·결측 선택·내생성·인과 식별을 자동으로 해결하지 않습니다. 표준오차 공식만 바꿔도 표본 OLS 계수는 바뀌지 않습니다.

제품·실무 사례 · 와인 성분과 품질 점수를 회귀로 읽되 생산 실험으로 오해하지 않기

UCI Wine Quality의 포르투갈 Vinho Verde 레드와인 실제 제품·실험실 측정 기록 1599개를 사용합니다. 회사·생산자·브랜드·판매가격은 이 자료에서 식별되지 않습니다. 따라서 한 회사의 실적이나 기업 간 비교로 부르지 않습니다. x는 알코올 부피 백분율, y는 최소 3명 전문가 평가의 중앙값인 0–10 품질점수입니다. 감각평가의 순서형 점수이며 숫자 간격이 모두 같다는 사실이 보장된 것은 아닙니다.

점수를 수치로 취급해 제곱손실 직선 ŷ≈1.874975 + 0.360842×알코올%를 선택합니다. 이것은 학습용 모형 선택입니다. 알코올 수치를 1 늘림은 “알코올 1%포인트 차이”이며 기존 농도 대비 1% 상대 증가와 다릅니다. 이 관측 회귀는 다른 산도·당·황 성분과 생산 과정이 함께 변하는 자료의 연관성을 요약하며, 실제 술에 알코올을 추가하면 같은 점수 변화가 일어남을 보이지 않습니다.

전체 12개 원수치가 같은 추가 행은 240개입니다. 이들을 임의로 지우지 않고 원래 1599행을 보존합니다. 숫자가 같다고 반드시 같은 실물 표본이라는 뜻도, 서로 다른 독립 표본이라는 뜻도 아닙니다. 생산자·배치·반복 측정 키가 없어 독립성을 사실로 선언하지 않습니다. 이후 예측평가에서 같은 수치 기록이 훈련·시험 양쪽에 섞이면 누수가 될 수 있어 그룹 분할을 검토해야 합니다. 지금의 전자료 적합은 시험 성능이 아닙니다.

회귀 요약과 단위
항목실제 자료에서 계산한 값
레드와인 기록1599
관측 알코올 범위8.40–14.90 부피%
관측 품질 점수 범위3–8
OLS 기울기0.36084177 점수/알코올%포인트
표본 R²0.226734
고전적 기울기 SE0.01667516
HC1 기울기 SE0.01802847
먼저 생각한 뒤 풀이 보기: 평균 품질의 신뢰구간과 한 새 제품의 예측구간은 왜 다른가요?

같은 x에서 평균모수의 추정 변동에 새 제품 자체의 변동을 더해야 하므로 예측구간이 더 넓습니다. 공개 쿼리 CSV는 관측 범위의 최소·평균·최대 x에서 두 식을 비교합니다. 이 와인의 순서형·유계 점수를 정규 등분산 오차로 근사한 PI가 실제로 95%를 보장한다고 해석하지 않습니다. 가능한 점수 범위와 평가 목적에 맞는 순서형 모형도 검토할 수 있습니다.

h(x0)=1n+(x0−x‾)2SxxSEmean(x0)=s^h(x0)SEnew(x0)=s^1+h(x0)\begin{gathered}h(x_0)=\frac1n+\frac{(x_0-\overline x)^2}{S_{xx}}\\SE_{\rm mean}(x_0)=\widehat s\sqrt{h(x_0)}\\SE_{\rm new}(x_0)=\widehat s\sqrt{1+h(x_0)}\end{gathered}
먼저 생각한 뒤 풀이 보기: R²가 높으면 좋은 제조법과 미래 판매까지 알 수 있나요?

R²는 이 표본에서 평균만 쓰는 기준 대비 줄인 제곱편차의 몫입니다. 가격·판매량은 이 자료에 없고 미래 검증도 하지 않았습니다. 잔차의 곡률·산포·그룹 구조, 관측 범위와 누수 없는 별도 검증을 확인해야 합니다. 적합이 좋은 것과 잘못된 원인 해석이 없는 것은 다른 문제입니다.

실제 자료·잔차·진단·재현: actual16-country2024-GDPpc-and-period-life-expectancy.csv · actual3613-person-schooling-and-preserved-missing-log-wages.csv · actual1599-red-wine-laboratory-and-quality-records.csv · actual-country-OLS-fits-residuals-leverage-and-influence.csv · actual-person-OLS-fits-residuals-leverage-and-influence.csv · actual-company-OLS-fits-residuals-leverage-and-influence.csv · actual-three-linear-projection-summaries.csv · actual-person-conditional-sample-means-and-OLS-values.csv · actual-company-conditional-sample-means-and-OLS-values.csv · chosen-in-range-queries-and-classical-working-intervals.csv · provenance

Country case · What does a line between income and life expectancy describe?

Use the fixed World Bank snapshot for 16 countries in 2024. x is real GDP per capita divided by 10,000, measured in ten-thousand constant-2015 USD per person, not PPP or KRW. y is period life expectancy at birth: a population indicator conditional on prevailing mortality patterns, not a prediction of a specific person’s lifespan. Countries receive equal weight; these 16 are not declared a random sample of every country.

Actual country observations and in-sample line
CountryGDPpc: constant 2015 USD/personLife expectancy yearsLine fit yearsResidual years
Australia61,486.483.05183.667-0.616
Brazil9,566.776.02374.6351.388
Canada45,061.482.10880.8101.298
China13,119.178.01775.2532.764
Germany44,027.880.79380.6300.163
France39,683.482.98079.8743.106
United Kingdom47,901.081.38781.3040.083
Indonesia4,367.971.28873.731-2.443
India2,366.872.23573.383-1.148
Japan37,976.684.03679.5774.459
Korea, Rep.37,048.483.62979.4164.213
Mexico10,284.075.26474.7600.504
Singapore68,129.783.34684.823-1.476
United States66,856.578.89084.601-5.711
Viet Nam4,012.574.73673.6691.067
South Africa5,715.566.31273.965-7.653
Q(a,b)=∑i(yi−a−bxi)2(a^,b^)=arg⁡min⁡a,bQ(a,b)Sxy=∑i(xi−x‾)(yi−y‾)Sxx=∑i(xi−x‾)2b^=Sxy/Sxxa^=y‾−b^x‾\begin{gathered}Q(a,b)=\sum_i(y_i-a-bx_i)^2\\(\widehat a,\widehat b)=\arg\min_{a,b}Q(a,b)\\S_{xy}=\sum_i(x_i-\overline x)(y_i-\overline y)\\S_{xx}=\sum_i(x_i-\overline x)^2\\\widehat b=S_{xy}/S_{xx}\\\widehat a=\overline y-\widehat b\overline x\end{gathered}

The fitted line is ŷ≈72.970869 + 1.739588x. The slope is measured in life-expectancy years per ten-thousand-dollar difference in real GDP per person. At a fixed country’s x, y−ŷ is a vertical residual, not the shortest perpendicular distance in the scatterplot. OLS is the descriptive projection minimizing vertical squared residuals within the chosen straight-line class. It does not establish that the true conditional mean E[Y|X=x] is linear.

Think first, then reveal: Would increasing GDP cause life expectancy to rise by this slope?

No. Health systems, institutions, distribution, history and measurement may differ together. Transferring a cross-country relationship to the effect of an individual’s income is also an ecological error. Causal questions need identification. Rescaling GDP from dollars to ten-thousand dollars changes the numeric coefficient but not fitted values for the same countries.

Think first, then reveal: Should a country with a large residual or distant x automatically be deleted?

No. Leverage h measures unusual x position, residual measures y−fit, and Cook’s distance diagnoses coefficient sensitivity to deletion. They are different. The top three Cook distances here are USA (0.4866), ZAF (0.4739), JPN (0.0677). First inspect data, units and the question; preserve originals and report sensitivity under stated criteria.

Person-record case · Separate schooling-specific observed means from one fitted line

Use the 3,010 observed source-trimmed log wages among 3,613 men in Card’s 1976 public data. Summarize reported schooling years x and log wage y with a line. Preserve 603 missing wages and do not claim a representative all-men population or causal return to schooling. Original hourly wages are cents/hour and survey weights are unused. This simple observed regression does not control potential experience, occupation or region.

The in-sample line is ŷ≈5.570882 + 0.052094×schooling years. Compute observed means at each schooling value separately. A mean supported by few records has less data behind it. The following table and plot show x-specific observed averages, not individual people. The line weights each of the 3,010 people equally; it is not an equally weighted fit to schooling-level means regardless of their counts.

Observed means at each schooling value versus the line
Reported schooling yearsObserved nObserved mean logOLS line valueObserved mean−line
116.214615.622980.59163
225.682505.675070.00743
335.370415.72717-0.35676
435.377875.77926-0.40139
5105.733675.83135-0.09768
6165.795905.88345-0.08755
7295.939105.935540.00356
8686.026585.987640.03894
9815.978626.03973-0.06111
101255.964246.09182-0.12758
111596.081236.14392-0.06269
129926.249026.196010.05301
132816.268006.248110.01989
142636.301396.300200.00118
151606.250556.35230-0.10174
164596.384556.40439-0.01984
171516.381996.45648-0.07449
182076.558376.508580.04979
∑ie^i=0∑ixie^i=0e^i=yi−a^−b^xiE[U∣X]=0is a different statement\begin{gathered}\sum_i\widehat e_i=0\\\sum_i x_i\widehat e_i=0\\\widehat e_i=y_i-\widehat a-\widehat b x_i\\E[U\mid X]=0\\\text{is a different statement}\end{gathered}
Think first, then reveal: Do zero sums of residuals and x×residuals prove exogeneity?

No. OLS with an intercept imposes these sample identities through minimization. They do not prove a zero population conditional error mean or random assignment of schooling. They still hold when the line poorly approximates the actual conditional mean.

Think first, then reveal: Is log slope b exactly a b×100% wage increase?

A one-unit x change on the log-linear fitted comparison corresponds to a geometric-center ratio exp(b). exp(b)−1 is only approximately b for small b. Here the ratio change is about 5.348%; it is neither an arithmetic mean wage increase nor a causal schooling intervention effect.

Inference and diagnostics · The same slope can have different SE assumptions

VC=Var⁡^classical(b^)VC=s^2/Sxxs^2=∑ie^i2n−2VH=Var⁡^HC1(b^)wi=(xi−x‾)2e^i2VH=nn−2∑iwiSxx2\begin{gathered}V_C=\widehat{\operatorname{Var}}_{\rm classical}(\widehat b)\\V_C=\widehat s^2/S_{xx}\\\widehat s^2=\frac{\sum_i\widehat e_i^2}{n-2}\\V_H=\widehat{\operatorname{Var}}_{HC1}(\widehat b)\\w_i=(x_i-\overline x)^2\widehat e_i^2\\V_H=\frac n{n-2}\frac{\sum_iw_i}{S_{xx}^2}\end{gathered}

The classical slope SE is about 0.00286971 and HC1 SE about 0.00290688. An exact classical t reference requires conditions such as independent normal errors, a linear conditional mean and common variance. HC1 is a different variance estimator for heteroskedastic asymptotic inference with independent observations; it does not automatically repair clustering, missingness selection, endogeneity or causal identification. Changing the SE formula leaves the sample OLS slope unchanged.

Product-practice case · Regress quality scores on alcohol concentration without inventing a production experiment

Use 1,599 actual product/laboratory records for Portuguese Vinho Verde red wine in UCI Wine Quality. Companies, producers, brands and selling prices are not identified. This is neither one company’s performance nor a between-firm comparison. x is alcohol percent by volume; y is a 0–10 sensory quality score, the median of at least three expert evaluations. The score is ordinal; equally spaced numeric values are not guaranteed to have equal perceptual gaps.

Choose a squared-loss numeric-score model ŷ≈1.874975 + 0.360842×alcohol%. Treating score gaps equally is a modeling choice. Increasing x by one means one percentage point of alcohol concentration, not a 1% relative increase over the original concentration. The observed regression summarizes associations while acidity, sugar, sulfur measures and production may co-vary; it does not establish the effect of adding alcohol to a wine.

There are 240 additional rows sharing all 12 source numeric values with another row. Preserve all 1,599 original rows rather than silently deleting them. Equal numbers prove neither the same physical sample nor independent distinct samples. Producer, batch and repeated-measurement keys are unavailable, so independence is not asserted. Later prediction evaluation should consider grouping identical records to avoid train/test leakage. This full-data fit is not test performance.

Regression summary and units
QuantityCalculated from actual records
Red-wine records1599
Observed alcohol range8.40–14.90 percent by volume
Observed quality-score range3–8
OLS slope0.36084177 score/alcohol percentage point
Sample R²0.226734
Classical slope SE0.01667516
HC1 slope SE0.01802847
Think first, then reveal: Why do a mean-response CI and one-new-product PI differ?

A new product adds its own variation to uncertainty about a mean response, so a PI is wider. The public query CSV compares both formulas at minimum, mean and maximum observed x. A normal common-variance PI for this bounded ordinal score does not automatically have real 95% coverage. Ordinal models can be considered in light of the score range and task.

h(x0)=1n+(x0−x‾)2SxxSEmean(x0)=s^h(x0)SEnew(x0)=s^1+h(x0)\begin{gathered}h(x_0)=\frac1n+\frac{(x_0-\overline x)^2}{S_{xx}}\\SE_{\rm mean}(x_0)=\widehat s\sqrt{h(x_0)}\\SE_{\rm new}(x_0)=\widehat s\sqrt{1+h(x_0)}\end{gathered}
Think first, then reveal: Would a high R² reveal the best recipe and future sales?

R² is the fraction of sample squared deviations reduced relative to an intercept-only baseline. Price and sales are absent, and no future validation was performed. Check residual curvature, dispersion and grouping, the observed range and a separate leakage-free evaluation. Good fit and justified causal interpretation are different issues.

Actual data, residuals, diagnostics and reproduction: actual16-country2024-GDPpc-and-period-life-expectancy.csv · actual3613-person-schooling-and-preserved-missing-log-wages.csv · actual1599-red-wine-laboratory-and-quality-records.csv · actual-country-OLS-fits-residuals-leverage-and-influence.csv · actual-person-OLS-fits-residuals-leverage-and-influence.csv · actual-company-OLS-fits-residuals-leverage-and-influence.csv · actual-three-linear-projection-summaries.csv · actual-person-conditional-sample-means-and-OLS-values.csv · actual-company-conditional-sample-means-and-OLS-values.csv · chosen-in-range-queries-and-classical-working-intervals.csv · provenance

기초Foundations

47. 계수·표적·가정·진단을 한 보고에 묶는다47. Report coefficients, targets, assumptions and diagnostics together

보고서 첫 문장에는 원관측 단위·기간·포함/제외 수·x, y 단위를 씁니다. 다음에는 표본 직선인지 모집단 선형투영인지 조건부 평균인지, 또는 별도 식별을 갖춘 인과 표적인지 밝힙니다. 계수와 잔차 제곱합은 원자료와 나란히 제공합니다.

SE가 고전인지 HC1인지, 정확 또는 점근 기준인지, 자유도와 α는 무엇인지 적습니다. 예측이라면 평균 CI인지 새 관측 PI인지, 쿼리 범위·독립 미래 가정·검증 자료가 있는지도 씁니다.

진단에서 민감한 원키와 가정 삭제의 변화를 보존합니다. 유의성을 얻기 위해 고른 변환·제외를 숨기지 않습니다. 숫자 표시 한계는 수학적 미정의와 다르게 안내합니다. 같은 계산을 Python/R로 다시 확인할 때도 원자료·행 정렬·결측 규칙을 맞춥니다.

Begin with source units, time, inclusion/exclusion counts and x/y units. State whether the target is a sample line, population linear projection, conditional mean or separately identified causal effect. Present coefficients and SSE alongside source records.

Name classical versus HC1 SE, exact versus asymptotic reference, df and α. For prediction, specify mean CI versus new-response PI, query support, future independence and validation data.

Preserve influential keys and hypothetical-deletion changes. Disclose selected transformations and exclusions. Separate numeric display limits from mathematical undefinedness, and align rows/missingness when reproducing calculations in Python or R.

기초Foundations

48. 공식 모형·예측·진단 문서를 조건과 함께 읽는다48. Read primary fitting, prediction and diagnostic references with their conditions

R 공식 lm의 Details·Value와 summary.lm의 Value에서 절편·잔차·자유도·SE·R²의 뜻을 대조하세요. 기본 결측 처리나 가중치를 바꾸면 같은 포함 자료인지 먼저 확인합니다.

predict.lm의 Details와 Note에서는 평균 표준오차·새 관측 분산·랭크결손 추정 가능성을 나누어 읽으세요. 공식 삭제 진단 문서의 leverage·Cook·leave-one-out 구별은 실습 E와 연결됩니다.

NIST의 R²와 잔차 그림은 높은 R²만으로 충분하지 않음을 설명합니다. sandwich 공식 매뉴얼의 vcovHC, 인쇄 29–30쪽은 이분산 공분산과 여러 HC 정의의 차이를 다룹니다. 이 장은 HC1을 명시적으로 선택하며 기본 HC3와 구별합니다. 다음 장에서는 재표집과 순열의 반복 실험을 설계합니다.

Python · R · 원자료·단위·가공·출처

Read Details/Value in official R lm and Value in summary.lm for intercepts, residuals, df, SE and R². Changing missingness or weights changes the analyzed records or loss.

predict.lm Details/Note distinguishes mean SE, new-response variance and rank-deficient estimability. Official deletion-diagnostic documentation connects leverage, Cook and leave-one-out to Lab E.

NIST residual analysis explains why high R² is insufficient. Read vcovHC on printed pages 29–30 of the official sandwich manual for heteroskedastic covariance and distinct HC choices. We explicitly choose HC1 rather than its HC3 default. The next chapter designs resampling and permutation repetitions.

Python · R · Inputs, units, transformations and sources

Python·R 코드 실행 방법Run the Python/R companions

자료 묶음을 풀고 코드와 실제데이터 폴더를 함께 두세요. 터미널에서 코드 파일이 있는 폴더로 이동해 아래 명령을 실행합니다. 코딩이 처음이라면 손계산과 웹 실습을 먼저 하고, 데이터 사이언스 입문에서 코드를 배운 뒤 돌아와도 됩니다.Extract the bundle, keeping the scripts beside the data folder. In a terminal, enter the script folder and run the commands below. Beginners can complete hand calculations and browser labs first, returning to code after studying introductory data science.

python stat15-reproduce.py
Rscript --vanilla --encoding=UTF-8 stat15-reproduce.R

결과 파일은 각 코드에 지정된 결과 폴더에 저장됩니다. CSV 원자료는 덮어쓰지 않습니다.Result files are saved in the result directory specified by each script; the input CSVs are not overwritten.

영상·학자·함께 읽기Videos, thinkers and guided reading

본문의 질문을 넓히는 선택 학습입니다. 영상을 보기 전 질문을 먼저 읽고, 자신의 답을 쓴 뒤 해설과 비교하세요. 자료의 언어·선수 지식은 각 항목에 표시했습니다.Optional extensions to the chapter. Read the question first, write your answer, then compare with the explanation. Language and prerequisites are indicated below.

Khan Academy · 잔차와 최소제곱의 시작Khan Academy · Introduction to residuals and least squares

Khan Academy

같은 x에서 실제 y−직선값의 세로 잔차를 따라갑니다. 최소화하는 양과 인과 질문을 구별하고 실제 CSV 한 행의 잔차를 계산해 보세요.Follow vertical y−line residuals at a fixed x, distinguish minimization from causal questions, and calculate a residual for an actual CSV row.

교재 안의 YouTube 플레이어에서 재생합니다. 원영상에서 제공하는 자막은 플레이어의 CC·설정에서 선택할 수 있습니다.Playback stays in this chapter’s YouTube player. Available captions can be selected through CC/settings.

보고 읽은 뒤 답하기Respond after watching/reading 회귀 잔차는 산점도 점에서 직선까지의 최단거리인가요?Is a regression residual the shortest distance from a scatter point to the line?

생각을 점검하는 해설Check your reasoning

보통의 y에 대한 OLS에서는 같은 x의 세로 차이입니다. 그림의 최단 수직거리와 다릅니다.Ordinary OLS for y uses the vertical difference at the same x, not the shortest perpendicular geometric distance.

가우스 · 관측 오차와 최소제곱의 역사Gauss · Observational errors and least-squares history

University of St Andrews · MacTutor

대학 소개의 관측·측지와 1823년 오차 조합 저술 부분을 읽습니다. 최소제곱을 역사의 한 사람에게만 돌리기보다 측정과 모형 가정의 연결을 생각합니다.Read the observation/geodesy and 1823 error-combination passages; focus on measurement and assumptions rather than assigning all least-squares history to one person.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 잔차를 작게 만드는 계산만 있으면 측정 오차 문제도 해결되나요?Does minimizing residuals automatically solve measurement-error problems?

생각을 점검하는 해설Check your reasoning

아닙니다. 측정 도구·단위·자료 생성과 선택 모형을 확인해야 합니다.No. Measurement instruments, units, acquisition and the selected model still require scrutiny.

NIST · 모수에 선형인 모형과 제곱손실NIST · Linear-in-parameter models and squared loss

NIST/SEMATECH · Linear Least Squares

Definition of a Linear Least Squares Model와 Why Least Squares?의 정의·최소화 목적만 읽습니다. 일반적인 최적성·뒤 비선형 예시를 조건 없이 옮겨 쓰지 않습니다.Read only the model definition and squared-deviation objective in Why Least Squares? Do not import unqualified optimality claims or the later nonlinear example.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 선형 회귀는 반드시 원래 x의 직선만 가능한가요?Must linear regression always be a straight line in the original x?

생각을 점검하는 해설Check your reasoning

모수에 선형이면 x²·log x 같은 미리 정한 변환도 사용할 수 있습니다. 여기에서는 해석을 위해 절편과 x의 직선만 선택했습니다.Predetermined transforms such as x² or log x can remain linear in parameters; this chapter deliberately chooses an intercept and x for clarity.

NIST · R²만으로 충분하지 않은 이유NIST · Why R² alone is insufficient

NIST/SEMATECH · Model Validation

R² Is Not Enough!, Main Tool, Residuals 부분만 읽고 원자료의 잔차·x·적합값을 비교합니다. 보기 좋은 잔차 그림도 인과성이나 미래 성능의 증명은 아닙니다.Read only R² Is Not Enough!, Main Tool and Residuals; compare actual residuals, x and fitted values. A reassuring plot does not prove causality or future performance.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading OLS 잔차 합이 0인 것과 잔차 그림에 곡률이 없는 것은 같은가요?Does a zero OLS residual sum imply no curvature in a residual plot?

생각을 점검하는 해설Check your reasoning

아닙니다. 합이 0인 곡선 패턴도 얼마든지 있습니다. 대수적 합계와 모형 모양의 진단을 구별합니다.No. Curved residual patterns can sum to zero; separate algebraic totals from diagnostics of functional form.

연습문제 · 계산에서 설명과 증명까지Exercises: calculation, explanation and proof

먼저 혼자 풀고 풀이를 여세요. 숫자와 함께 단위·포함 기준·계산 이유를 확인하세요.Attempt each problem before opening its solution. Check units, inclusion rules and the reason for the calculation.

1. 기울기의 단위Slope units

x가 시간(시간), y가 생산량(개)이고 적합 기울기가 3이면 무엇을 뜻하나요?

If x is hours, y is produced units and fitted slope is 3, what does it mean?

풀이와 확인할 이유Solution and explanation

적합 직선에서 x가 1시간 달라질 때 y 적합값이 3개 달라진다는 뜻입니다. 단위는 개/시간입니다. 서로 다른 기록의 연관 직선이므로 작업 시간을 1시간 늘리는 개입의 인과 효과라는 결론은 별도입니다.

The fitted response changes by three units per additional hour along the line. Units are output units/hour. A cross-record association is not automatically a causal intervention effect.

2. 짝 결측Paired missingness

x=(0, null,2,3), y=(1,4, null,5)에서 완전짝으로 남는 원입력 위치와 쌍을 쓰세요. 위치는 0부터 셉니다.

For x=(0, null,2,3), y=(1,4, null,5), list retained complete pairs with zero-based source positions.

풀이와 확인할 이유Solution and explanation

위치 0의 (0,1), 위치 3의 (3,5)만 남습니다. 각각의 가용 열을 따로 모은 (0,2,3)과 (1,4,5)를 짝지으면 원자료를 바꿉니다.

Positions 0 and 3 retain (0,1) and (3,5). Independently extracting available columns would invent different pairings.

3. 잔차의 방향Residual direction

직선 ŷ=1+0.8x, 관측 (x, y)=(2,2)에서 적합값·잔차·제곱잔차를 구하세요.

For ŷ=1+.8x and observed (x, y)=(2,2), find fit, residual and squared residual.

풀이와 확인할 이유Solution and explanation

적합값 2.6, 잔차 2−2.6=−0.6, 제곱잔차 0.36입니다. 음의 잔차는 관측이 직선 아래임을 뜻하며 x축 거리나 최단 직교거리가 아닙니다.

The fit is 2.6, residual −.6 and square .36. Negative means below the line along the response axis, not a predictor or shortest-perpendicular distance.

4. 두 후보 손실Compare candidate losses

가상 x=(0,1,2,3,4), y=(1,2,2,4,4)에서 직선 y=x와 y=1+0.8x의 SSE를 비교하세요.

For x=(0,1,2,3,4), y=(1,2,2,4,4), compare SSE for lines y=x and y=1+.8x.

풀이와 확인할 이유Solution and explanation

y=x의 잔차는 (1,1,0,1,0)이라 SSE=3입니다. 두 번째의 잔차는 (0,0.2,−0.6,0.6,−0.2)라 SSE=0.8입니다. 최소제곱 목적에서는 두 번째가 더 작습니다.

The first has residuals (1,1,0,1,0) and SSE=3. The second gives (0,.2,−.6,.6,−.2) and SSE=.8, so it is better under squared loss.

5. 기울기를 고정한 절편Intercept at a fixed slope

x̄=2,ȳ=2.6이고 기울기 b=0.5를 고정했습니다. 최선 절편은 무엇인가요?

Given x̄=2,ȳ=2.6 and fixed b=.5, find the optimal intercept.

풀이와 확인할 이유Solution and explanation

a=ȳ−bx̄=2.6−1=1.6입니다. y−0.5x의 평균을 맞추는 상수 문제입니다. b까지 다시 최적화한 전체 기울기와는 구별합니다.

a=2.6−.5×2=1.6, the mean of y−.5x. This holds b fixed rather than reoptimizing the slope.

6. 중심화 곱합Centered sums

x=(0,1,2,3,4), y=(1,2,2,4,4)에서 Sxx와 Sxy를 구하세요.

Find Sxx and Sxy for x=(0,1,2,3,4), y=(1,2,2,4,4).

풀이와 확인할 이유Solution and explanation

중심화 x는 (−2,−1,0,1,2)이므로 Sxx=10입니다. Σ(x−2)y=−2−2+0+4+8=8이고 Σ(x−2)=0이라 Sxy=8입니다.

Centered x=(−2,−1,0,1,2) gives Sxx=10. Since centered x sums to zero, Sxy=Σ(x−2) y=8.

7. 최적 계수Optimal coefficients

x̄=2,ȳ=13/5, Sxx=10, Sxy=8일 때 절편·기울기와 평균점 통과를 확인하세요.

For x̄=2,ȳ=13/5, Sxx=10, Sxy=8, find coefficients and verify the mean point.

풀이와 확인할 이유Solution and explanation

b̂=4/5,â=13/5−(4/5)2=1입니다. x=2를 넣으면 13/5로 평균점을 지납니다. 이는 절편이 있는 최소제곱의 수치 조건입니다.

b̂=4/5 and â=1. At x=2, the fitted value is 13/5, the response mean. This is the intercept-fit identity.

8. 기본 적합과 잔차Default fits and residuals

x=(0,1,2,3,4), y=(1,2,2,4,4),ŷ=1+0.8x에서 적합값과 잔차 벡터를 구하세요.

For x=(0,1,2,3,4), y=(1,2,2,4,4) and ŷ=1+.8x, list fitted values and residuals.

풀이와 확인할 이유Solution and explanation

적합값은 (1,1.8,2.6,3.4,4.2), 잔차는 (0,0.2,−0.6,0.6,−0.2)입니다. 잔차를 적합−관측으로 뒤집지 않고 관측−적합 순서를 유지합니다.

Fits are (1,1.8,2.6,3.4,4.2); residuals are (0,.2,−.6,.6,−.2). Retain observation-minus-fit order.

9. 정규방정식 직접 확인Check normal equations

x=(0,1,2,3,4), e=(0,1/5,−3/5,3/5,−1/5)에서 Σe,Σxe를 구하고 모집단 의미를 설명하세요.

For x=(0,1,2,3,4), e=(0,1/5,−3/5,3/5,−1/5), compute Σe and Σxe and interpret their scope.

풀이와 확인할 이유Solution and explanation

Σe=0,Σxe=(1−6+9−4)/5=0입니다. 이는 절편·기울기를 맞춘 자료의 직교 조건입니다. 모집단 오차의 조건부 평균 0이나 잔차 독립을 증명하지 않습니다.

Both are zero. These are observed fitting orthogonality conditions, not proof of zero population conditional-error means or independent residuals.

10. 상수 x의 비유일성Nonunique constant-x coefficients

모든 x=2이고 ȳ=3입니다. 서로 다른 두 최소제곱 (절편, 기울기)를 쓰고 x=0 예측을 비교하세요.

Every x=2 and ȳ=3. Give two least-squares coefficient pairs and compare predictions at x=0.

풀이와 확인할 이유Solution and explanation

(3,0)과 (1,1)은 모두 x=2에서 적합값 3입니다. 그러나 x=0에서 3과 1을 줍니다. 관측 지점의 적합은 같아도 범위 밖 직선은 유일하지 않습니다.

(3,0) and (1,1) both fit 3 at observed x=2, but predict 3 and 1 at zero. Unique observed fits do not imply a unique extrapolating line.

11. 두 점의 정보Information in two points

완전짝이 (0,1),(1,3) 두 개입니다. 직선과 잔차 자유도를 구하세요.

The only complete pairs are (0,1),(1,3). Find the line and residual df.

풀이와 확인할 이유Solution and explanation

직선은 y=1+2x로 두 점을 지나고 SSE=0입니다. 잔차 자유도 n−2=0이라 이 장의 s²·t 기준은 미정의입니다. 직선 두 계수를 계산할 정보와 오차분산을 추정할 정보는 다릅니다.

The line y=1+2x interpolates both points, SSE=0 and df=0. The lab’s residual-variance/t pivot is undefined; fitting two coefficients differs from estimating error variance.

12. 상수 응답Constant response

x=(0,1,2), y=(4,4,4)에서 직선·r·R²를 구별하세요.

For x=(0,1,2), y=(4,4,4), distinguish the fitted line, r and R².

풀이와 확인할 이유Solution and explanation

Sxx>0이라 기울기 0, 절편 4의 직선은 정의됩니다. Syy=0이므로 r과 R²는 분모 0으로 미정의입니다. 관측 수치가 일정하다는 사실이 모든 모집단 변동 0을 증명하지는 않습니다.

The line has slope zero and intercept four. Syy=0 makes r and R² undefined. Constant observations do not prove zero population variation.

13. 기본 R²Default R squared

기본 자료의 SST=36/5, SSE=4/5입니다. R²를 구하고 잘못된 해석 하나를 피하세요.

For SST=36/5 and SSE=4/5, find R² and rule out one invalid interpretation.

풀이와 확인할 이유Solution and explanation

R²=1−(4/5)/(36/5)=8/9입니다. 관측 중심화 제곱합의 적합 몫이지 사람 8/9를 정확히 예측하거나 인과 효과가 8/9라는 뜻은 아닙니다.

R²=8/9, the fitted share of observed centered SS. It is not a fraction of people predicted exactly or a causal contribution.

14. 역방향 회귀Reverse regression

Sxx=10, Sxy=8, Syy=36/5입니다. y를 x에 회귀한 기울기와 x를 y에 회귀한 기울기가 서로 역수인가요?

Given Sxx=10, Sxy=8, Syy=36/5, are the y-on-x and x-on-y slopes reciprocals?

풀이와 확인할 이유Solution and explanation

앞 기울기는 4/5, 뒤 기울기는 8/(36/5)=10/9입니다. 4/5의 역수 5/4와 다릅니다. 두 방향의 세로 오차를 최소화하는 문제가 다르기 때문입니다.

They are 4/5 and 10/9, not reciprocal 5/4. Reversing the response changes the squared-error direction.

15. 상관과 기울기Correlation and slope

단순 절편 회귀에서 b̂=4/5>0, R²=8/9입니다. r을 구하세요.

In simple intercept OLS, b̂=4/5>0 and R²=8/9. Find r.

풀이와 확인할 이유Solution and explanation

양의 기울기라 r=+√(8/9)=2√2/3≈0.942809입니다. 두 변수의 퍼짐이 양수라는 조건을 확인하며 r²=R²를 씁니다.

Positive slope gives r=+√(8/9)=2√2/3≈.942809, assuming both variables have positive spread.

16. 평평한 최선 직선A flat best line

X가 −1,0,1을 동일 확률로 갖고 Y=X²입니다. 최선 모집단 직선과 참 조건부 평균을 구하세요.

X is uniform on −1,0,1 and Y=X². Find the best population line and true conditional mean.

풀이와 확인할 이유Solution and explanation

E[X]=0, E[Y]=2/3, Cov(X, Y)=0이므로 최선 직선은 2/3입니다. 하지만 m(X)=X²로 완전히 비선형 관계가 있습니다. 선형 기울기 0은 관계 없음이 아닙니다.

E[X]=0, E[Y]=2/3 and covariance zero give best line 2/3. Yet m(X)=X² exactly, so zero slope does not mean no relationship.

17. 조건부 평균의 위험 이점Risk advantage of the conditional mean

X는 −1,0,1 동일 확률, Y=X²+ε입니다. ε는 X와 독립, 평균 0, 분산 1입니다. g(X)=2/3와 m(X)=X²의 제곱위험을 비교하세요.

X is uniform on −1,0,1, Y=X²+ε and ε is independent, zero-mean with variance one. Compare squared risks of g=2/3 and m=X².

풀이와 확인할 이유Solution and explanation
E[(X2−2/3)2]=29,R(m)=E[ε2]=1,R(g)=1+29=119.\begin{aligned} E[(X^2-2/3)^2]&=\frac29,\\ R(m)&=E[\varepsilon^2]=1,\\ R(g)&=1+\frac29=\frac{11}9. \end{aligned}

직선 제한으로 남은 평균 함수 오차가 2/9의 추가 위험입니다. 표본의 학습 오차는 이 모집단 계산과 다시 구별합니다.

E[(X2−2/3)2]=29,R(m)=1,R(g)=1+29=119.\begin{aligned} E[(X^2-2/3)^2]&=\frac29,\\ R(m)&=1,\\ R(g)&=1+\frac29=\frac{11}9. \end{aligned}

The line restriction adds mean-function error 2/9. Finite-data estimation error is another issue.

18. 관측 같은 x 평균Observed same-x means

x=(0,0,1,1,2,2), y=(1,3,2,6,5,7)의 같은 x 평균과 OLS 직선을 구하세요.

For x=(0,0,1,1,2,2), y=(1,3,2,6,5,7), find same-x means and the OLS line.

풀이와 확인할 이유Solution and explanation

그룹 평균은 2,4,6이고 그룹 크기가 모두 2입니다. 이 평균들이 직선 2+2x 위에 있으므로 OLS도 그 직선입니다. 집단 안 잔차는 (−1,1,−2,2,−1,1)이라 SSE=12로, 그룹 평균 세 점만으로 계산한 SSE=0과 다릅니다.

Equal-sized group means are 2,4,6, on line 2+2x. Raw residual SSE is 12, not the zero SSE obtained from only three means. Coefficients can agree while omitted within variation matters.

19. 표본 평균과 모집단 평균Sample versus population conditional means

x=12인 실제 가용 992개 로그 임금의 평균을 계산했습니다. 이를 E[Y|X=12]의 정확값이라 부를 수 있나요?

You averaged 992 available actual log wages at x=12. Is this exactly E[Y|X=12]?

풀이와 확인할 이유Solution and explanation

관측 조건부 표본 평균입니다. 가용 선택·표집 오차·원자료 절단과 모집단 정의를 확인해야 합니다. 값이 계산된다는 사실만으로 모집단 함수가 정확히 알려진 것은 아닙니다.

It is an observed conditional sample mean. Availability, source trimming, sampling and population definition matter; computability does not identify the population function exactly.

20. 불편성 가중합Weighted-error unbiasedness

고정 x 선형 모형에서 b̂−b=Σwᵢεᵢ입니다. 각 E[εᵢ]=0일 때 E[b̂]를 구하고 독립이 필요한지 설명하세요.

Under a fixed-design linear model, b̂−b=Σwᵢεᵢ and each E[εᵢ]=0. Find E[b̂] and whether independence is needed.

풀이와 확인할 이유Solution and explanation
E[b^]−b=∑iwiE[εi]=0.\begin{aligned} E[\widehat b]-b &=\sum_iw_iE[\varepsilon_i]=0. \end{aligned}

기대값 선형성만 필요하며 이 계산에는 오차 사이 독립이 필요하지 않습니다. 분산과 정확 t는 추가 조건을 사용합니다.

E[b^]−b=∑iwiE[εi]=0.\begin{aligned} E[\widehat b]-b &=\sum_iw_iE[\varepsilon_i]=0. \end{aligned}

Linearity of expectation suffices here. Variance and exact t calibration add assumptions.

21. 기울기의 모형 분산Model slope variance

고정 full-rank x 선형 모형에서 오차는 독립·평균 0, 공통분산 σ²=4이고 Sxx=10입니다. Var(b̂)를 구하세요.

Under fixed full-rank x, independent zero-mean errors have common variance σ²=4 and Sxx=10. Find Var(b̂).

풀이와 확인할 이유Solution and explanation

Var(b̂)=σ²/Sxx=2/5입니다. 표준편차는 √(2/5)입니다. 이 분산 식에는 정규성이 필요하지 않지만 정확 t 기준에는 추가 정규 가정이 필요합니다.

It is 4/10=2/5, with SD √(2/5). Normality is unnecessary for this variance identity but is added for exact classical t calibration.

22. 이분산 가중치Heteroskedastic weights

x=(−1,0,1), 독립 평균 0 오차의 분산이 (1,100,9)입니다. 선형 평균 모형의 기울기 분산을 구하세요.

For x=(−1,0,1), independent zero-mean errors have variances (1,100,9). Find slope variance under a linear mean.

풀이와 확인할 이유Solution and explanation
Sxx=2,w=(−1/2,0,1/2),Var⁡(b^)=14⋅1+0⋅100+14⋅9=52.\begin{aligned} S_{xx}&=2,\quad w=(-1/2,0,1/2),\\ \operatorname{Var}(\widehat b) &=\tfrac14\cdot1+0\cdot100+\tfrac14\cdot9\\ &=\frac52. \end{aligned}

평균 x의 오차는 이 설계의 기울기에 가중치 0이지만 절편에는 영향을 줄 수 있습니다. 분산을 단순 평균한 뒤 σ²/Sxx로 바꾸지 않습니다.

Sxx=2,w=(−1/2,0,1/2),Var⁡(b^)=52.\begin{aligned} S_{xx}&=2,\quad w=(-1/2,0,1/2),\\ \operatorname{Var}(\widehat b)&=\frac52. \end{aligned}

The middle error has zero slope weight here but can affect the intercept. Do not replace heterogeneous variances by their simple average.

23. 잔차분산과 훈련 MSEResidual variance versus training MSE

기본 n=5, SSE=4/5, Sxx=10에서 SSE/n, s², 고전 기울기 분산을 구하세요.

For n=5, SSE=4/5, Sxx=10, find SSE/n, s² and the classical estimated slope variance.

풀이와 확인할 이유Solution and explanation

SSE/n=4/25, s²=(4/5)/3=4/15, 기울기 분산 추정은 (4/15)/10=2/75입니다. 훈련 손실 분모 5와 잔차분산 보정 분모 3은 다른 역할입니다.

They are 4/25,4/15 and 2/75. Training-loss denominator five differs from the residual-df denominator three.

24. 기본 t 계산Default t statistic

b̂=4/5, 귀무 b₀=0, 고전 기울기 분산 2/75, n=5입니다. t와 자유도를 구하세요.

Given b̂=4/5, b₀=0, classical slope variance 2/75 and n=5, find t and df.

풀이와 확인할 이유Solution and explanation

t=(4/5)/√(2/75)=√24≈4.898979, 자유도 3입니다. 고전 정규 모형 아래 양쪽 참고 p≈0.0162766입니다. 값과 단위의 기울기·SE를 먼저 보존합니다.

t=√24≈4.898979 with df=3. Under the classical normal model, the two-sided reference p≈.0162766.

25. 정확 t의 조건Conditions for exact t

Sxx>0이고 n>2라는 사실만으로 기울기 t가 정확 tₙ₋₂인가요?

Do Sxx>0 and n>2 alone make the slope pivot exactly tₙ₋₂?

풀이와 확인할 이유Solution and explanation

아닙니다. 고정 설계의 올바른 선형 평균, 서로 독립인 정규 오차, 공통 양의 분산 같은 조건이 더 필요합니다. 랭크와 자유도는 계산 가능성 조건이지 원자료 생성의 검증이 아닙니다.

No. A correct fixed-design linear mean and independent normal common-positive-variance errors are additional conditions. Rank and df establish calculability, not field-model validity.

26. 기본 HC1 손계산Hand-calculate default HC1

x=(0,1,2,3,4), e=(0,1/5,−3/5,3/5,−1/5), Sxx=10입니다. HC1 기울기 분산을 구하세요.

For x=(0,1,2,3,4), e=(0,1/5,−3/5,3/5,−1/5), Sxx=10, find HC1 slope variance.

풀이와 확인할 이유Solution and explanation
∑i(xi−2)2ei2=1+9+425=1425,V^HC1=5314/25100=7750.\begin{aligned} \sum_i(x_i-2)^2e_i^2 &=\frac{1+9+4}{25}=\frac{14}{25},\\ \widehat V_{\rm HC1} &=\frac53\frac{14/25}{100} =\frac7{750}. \end{aligned}

HC1 SE는 √(7/750)≈0.096609입니다. 같은 적합 기울기에서 고전 추정 분산 2/75와 다릅니다.

∑i(xi−2)2ei2=1425,V^HC1=5314/25100=7750.\begin{aligned} \sum_i(x_i-2)^2e_i^2&=\frac{14}{25},\\ \widehat V_{\rm HC1} &=\frac53\frac{14/25}{100} =\frac7{750}. \end{aligned}

The HC1 SE is about .096609, different from classical variance 2/75 for the same fitted slope.

27. 강건 SE는 항상 큰가Is robust always larger

같은 자료에서 고전 분산 2/75, HC1 분산 7/750입니다. HC1이 항상 더 큰 안전장치라는 주장이 맞나요?

The same fit has classical slope variance 2/75 and HC1 variance 7/750. Is HC1 always a larger safety margin?

풀이와 확인할 이유Solution and explanation

아닙니다. 2/75=20/750이므로 여기 HC1이 더 작습니다. 분산 추정식이 다른 것이며 항상 더 보수적이라는 정리는 없습니다. 특히 작은 n의 정확성도 자동 보장되지 않습니다.

No. Here classical variance is 20/750, larger than HC1. Different formulas do not guarantee a conservative ordering or exact small-sample validity.

28. 누락 변수 기울기Omitted-variable slope

가상 Y=βX+γZ+u, E[u|X, Z]=0, Var(X)>0이고 β=0,γ=2, Cov(X, Z)/Var(X)=1입니다. 단순 회귀 기울기를 구하세요.

In hypothetical Y=βX+γZ+u with E[u|X, Z]=0 and Var(X)>0, β=0,γ=2 and Cov(X, Z)/Var(X)=1. Find the simple slope.

풀이와 확인할 이유Solution and explanation

b단순=β+γCov/Var=2입니다. 직접 계수 β=0과 공존합니다. 이 가상 예는 연관 기울기가 인과 직접 효과와 같아야 한다는 주장의 반례입니다.

It is 2 although the direct coefficient is zero. This counterexample separates an associational slope from a direct causal interpretation.

29. x 단위 바꾸기Change predictor units

기존 직선 y=1+0.8x에서 x*=x/1000으로 바꾸었습니다. 새 직선과 기울기 변화의 뜻을 쓰세요.

For y=1+.8x, define x*=x/1000. Write the new line and interpret the slope change.

풀이와 확인할 이유Solution and explanation

x=1000x*이므로 y=1+800x*입니다. 새 x 한 단위가 원래 1000단위여서 기울기가 1000배입니다. 적합값이나 기저 현상이 새로 바뀐 것이 아닙니다.

The line becomes y=1+800x*. One new unit represents 1000 old units; fits and the underlying observations have not changed.

30. 중심화 절편Centered intercept

기본 직선 y=1+0.8x, x̄=2에서 z=x−2로 바꾸면 어떻게 쓰나요?

For y=1+.8x and x̄=2, write the line using z=x−2.

풀이와 확인할 이유Solution and explanation

x=z+2이므로 y=2.6+0.8z입니다. 중심화 절편 2.6은 관측 평균 x에서의 적합값이며 원절편 1과 다른 좌표의 값입니다.

It becomes y=2.6+.8z. The centered intercept is the fitted response at mean x, not the raw zero-x intercept.

31. x₀=3의 평균·새 분산Mean and new variance at three

기본 n=5, x̄=2, Sxx=10, s²=4/15, 직선 1+0.8x에서 x₀=3의 중심·h₀·평균 추정 분산·새 관측 분산을 구하세요.

For n=5, x̄=2, Sxx=10, s²=4/15 and line 1+.8x, find center, h₀, mean-estimation variance and new-response variance at x₀=3.

풀이와 확인할 이유Solution and explanation
m^0=3.4,h0=15+110=310,V^mean=415310=225,V^new=4151310=2675.\begin{aligned} \widehat m_0&=3.4,\quad h_0=\tfrac15+\tfrac1{10}=\tfrac3{10},\\ \widehat V_{\rm mean}&=\tfrac4{15}\tfrac3{10}=\tfrac2{25},\\ \widehat V_{\rm new}&=\tfrac4{15}\tfrac{13}{10}=\tfrac{26}{75}. \end{aligned}

두 분산의 차이는 s²입니다. 평균 추정과 새 개별 변동이 다른 표적임을 보여줍니다.

m^0=3.4,h0=310,V^mean=225,V^new=2675.\begin{aligned} \widehat m_0&=3.4,\quad h_0=\tfrac3{10},\\ \widehat V_{\rm mean}&=\tfrac2{25},\\ \widehat V_{\rm new}&=\tfrac{26}{75}. \end{aligned}

The difference is s², the additional new-response variation.

32. 가장 좁은 평균 구간Narrowest mean interval

고정 자료의 s²>0, Sxx>0에서 h₀=1/n+(x₀−x̄)²/Sxx는 어디서 최소인가요?

For fixed data with positive s² and Sxx, where is h₀=1/n+(x₀−x̄)²/Sxx minimized?

풀이와 확인할 이유Solution and explanation

제곱항이 0인 x₀=x̄에서 최소 1/n입니다. 따라서 같은 α·정규 모형의 평균 구간도 그 지점에서 가장 좁습니다. 평균 함수가 잘못된 오차까지 없앤다는 뜻은 아닙니다.

At x₀=x̄, the squared term vanishes and h₀=1/n. The classical pointwise mean interval is narrowest there, without eliminating model misspecification.

33. 두 폭의 비율Ratio of interval widths

n=5이고 x₀=x̄입니다. 공통 s>0와 같은 양의 t 임계값을 쓰는 새 관측 PI 반폭/평균 CI 반폭을 구하세요.

With n=5, x₀=x̄, a common s>0 and the same positive t critical value, find new-PI half-width divided by mean-CI half-width.

풀이와 확인할 이유Solution and explanation

h₀=1/5이므로 비는 √[(1+1/5)/(1/5)]=√6≈2.44949입니다. 새 개별 오차가 추가되어 항상 더 넓습니다. 같은 고전 모형의 두 표적을 비교한 결과입니다.

The ratio is √[(1+1/5)/(1/5)]=√6≈2.44949. New noise makes the PI wider under the same classical model.

34. 기본 평균 구간Default mean interval

기본 x₀=2에서 중심 2.6, 평균 분산 4/75, t₀.₉₇₅,₃≈3.1824463입니다. 95% 평균 구간을 구하세요.

At x₀=2, the fitted mean is 2.6, estimated mean variance 4/75 and t₀.₉₇₅,₃≈3.1824463. Find the 95% mean CI.

풀이와 확인할 이유Solution and explanation

2.6±3.1824463√(4/75)≈[1.865046,3.334954]입니다. 평균 반응을 감싸는 점별 구간이며 개별 관측의 95%를 감싼다는 설명은 아닙니다.

It is approximately [1.865046,3.334954]. This is pointwise mean coverage, not coverage of 95% of individual responses.

35. 기본 새 관측 구간Default new-response interval

기본 x₀=2에서 중심 2.6, 새 관측 분산 8/25, t임계값≈3.1824463입니다. 고전 95% PI를 구하고 조건을 쓰세요.

At x₀=2, the fit is 2.6, new-response variance 8/25 and t critical≈3.1824463. Find the classical 95% PI and state conditions.

풀이와 확인할 이유Solution and explanation

2.6±3.1824463√(8/25)≈[0.799737,4.400263]입니다. 고정 full-rank 설계의 선형 평균·독립 정규 공통 양의 분산 훈련 오차와, 그 전체와 독립인 같은 법칙의 새 오차를 가정합니다.

It is about [.799737,4.400263], under a full-rank fixed linear mean, independent normal common-positive-variance training errors and a same-law new error independent of all training errors.

36. 새 관측이 훈련과 의존Dependence with the new response

Var(Y₀)=1, Var(m̂₀)=0.2, Cov(Y₀, m̂₀)=0.05입니다. Var(Y₀−m̂₀)를 구하세요.

If Var(Y₀)=1, Var(m̂₀)=.2 and Cov(Y₀, m̂₀)=.05, find Var(Y₀−m̂₀).

풀이와 확인할 이유Solution and explanation

1+0.2−2×0.05=1.1입니다. 독립이면 공분산 0이 충분하지만 비독립에서도 0일 수 있습니다. 새 관측과 훈련이 독립이라는 가정을 확인하지 않고 무조건 1.2로 더하지 않습니다.

It is 1+.2−2×.05=1.1. Independence is sufficient for zero covariance, not necessary. Do not silently use the independent sum 1.2.

37. 점별과 동시Pointwise versus simultaneous

x 지점 100개에서 각각 95% 평균 구간을 그렸습니다. 모두 동시에 참 평균을 감쌀 확률이 95%인가요?

You draw a 95% mean CI at each of 100 x values. Is simultaneous coverage of all true means guaranteed to be 95%?

풀이와 확인할 이유Solution and explanation

일반적으로 그런 보장은 없습니다. 각 고정 지점의 점별 보장과 전체 함수·여러 지점의 동시 보장은 다릅니다. 구간 간 독립도 가정할 수 없으므로 0.95¹⁰⁰을 자동 답으로 쓰지 않습니다.

No. Pointwise and simultaneous coverage differ. Intervals are also dependent, so automatically using .95¹⁰⁰ would be unjustified.

38. 먼 외삽Distant extrapolation

훈련 x 범위가 [0,4]인데 x₀=100의 구간을 소프트웨어가 계산했습니다. 무엇을 더 확인해야 하나요?

Training x lies in [0,4], but software calculates an interval at x₀=100. What else is required?

풀이와 확인할 이유Solution and explanation

범위 밖에서도 같은 선형 평균·오차 법칙이 유지된다는 근거와 실제 새 자료 검증이 필요합니다. 계산된 폭은 그 모형 아래의 계수 불확실성·새 오차를 반영할 뿐, 모든 구조 변화나 모형 오차를 보장하지 않습니다.

Justification for extending the mean/error model and appropriate new-data validation. The formula reflects uncertainty under its model, not every structural change or misspecification.

39. 기본 leverageDefault leverage

x=(0,1,2,3,4), x̄=2, Sxx=10에서 leverage 벡터와 합을 구하세요.

For x=(0,1,2,3,4), x̄=2, Sxx=10, find leverage values and their sum.

풀이와 확인할 이유Solution and explanation

hᵢ=1/5+(xᵢ−2)²/10이므로 (3/5,3/10,1/5,3/10,3/5)입니다. 합은 2로 두 계수의 설계 랭크와 같습니다. y는 이 계산에 들어가지 않습니다.

They are (3/5,3/10,1/5,3/10,3/5), summing to two, the fitted rank. No y value enters this calculation.

40. 훈련 잔차와 새 오차Training residual versus new error

고전 공통분산 모형에서 σ²=4, hᵢ=0.6입니다. Var(eᵢ)와 같은 x의 독립 새 관측 예측 오차 분산을 비교하세요.

Under the classical common-variance model, σ²=4 and hᵢ=.6. Compare Var(eᵢ) with independent new-response prediction-error variance at the same x.

풀이와 확인할 이유Solution and explanation

훈련 잔차 분산은 4(1−0.6)=1.6, 새 관측 예측 오차 분산은 4(1+0.6)=6.4입니다. 훈련 점은 자기 적합에 참여하므로 두 표적의 변동이 다릅니다.

They are 4(1−.6)=1.6 and 4(1+.6)=6.4. The training point participates in fitting; the new observation does not.

41. Cook 손계산Hand-calculate Cook distance

기본 자료 마지막 점의 e=−1/5, h=3/5, s²=4/15입니다. 두 모수 Cook 거리를 구하세요.

The default last point has e=−1/5, h=3/5 and s²=4/15. Compute its two-parameter Cook distance.

풀이와 확인할 이유Solution and explanation
D=1/252(4/15)3/5(2/5)2=340154=932.\begin{aligned} D&=\frac{1/25}{2(4/15)} \frac{3/5}{(2/5)^2}\\ &=\frac3{40}\frac{15}4=\frac9{32}. \end{aligned}

이는 적합 민감도의 기술량입니다. 9/32라는 값만으로 원자료 오류·삭제를 확정하지 않습니다.

D=1/252(4/15)3/5(2/5)2=932.\begin{aligned} D&=\frac{1/25}{2(4/15)} \frac{3/5}{(2/5)^2}\\ &=\frac9{32}. \end{aligned}

This describes fit sensitivity, not proof that the record is erroneous or should be removed.

42. 마지막 점 삭제 비교Delete the last point hypothetically

기본 x=(0,1,2,3,4), y=(1,2,2,4,4)에서 마지막 점만 가정상 삭제합니다. 기존 b=0.8에서 새 기울기와 절편을 구하세요.

From default x=(0,1,2,3,4), y=(1,2,2,4,4), hypothetically delete only the last point. Find new slope and intercept.

풀이와 확인할 이유Solution and explanation

남은 평균은 x̄=1.5,ȳ=2.25, Sxx=5, Sxy=4.5입니다. 새 기울기 0.9, 절편 0.9입니다. 원기울기 대비 변화 +0.1이며 원기록과 원적합은 별도 보존합니다.

Remaining means are 1.5 and 2.25, with Sxx=5, Sxy=4.5. New slope and intercept are .9 and .9. Preserve the original .8 slope and records alongside this +.1 sensitivity.

43. leverage 1의 경계Leverage-one boundary

x=(0,0,1), y=(1,3,5)에서 마지막 점의 적합값·잔차·leverage와 삭제 후 랭크를 설명하세요.

For x=(0,0,1), y=(1,3,5), describe the last fit, residual, leverage and rank after deletion.

풀이와 확인할 이유Solution and explanation

x=0의 평균 2와 x=1의 값 5를 연결한 y=2+3x입니다. 마지막 점의 잔차 0, h=1입니다. 삭제하면 x가 모두 0이 되어 기울기 비유일입니다. Cook 식의 0/(1−1)²를 임의 0으로 채우지 않습니다.

The line is y=2+3x. The last residual is zero and h=1. Deletion leaves constant x and a nonunique slope; do not fill Cook’s 0/0 denominator with zero.

44. 잔차 공분산의 부호Residual covariance sign

고정 설계 선형 평균 모형에서 x=(0,1,2,3,4), n=5, Sxx=10이고 오차 공분산은 Cov(ε)=4I입니다. 첫·마지막 관측의 H₁₅와 잔차 공분산을 구하세요.

Under a fixed-design linear-mean model, x=(0,1,2,3,4), n=5, Sxx=10 and Cov(ε)=4I. Find H₁₅ and covariance of first/last residuals.

풀이와 확인할 이유Solution and explanation
H15=15+(−2)(2)10=−15,Cov⁡(e1,e5)=−4H15=45.\begin{aligned} H_{15}&=\tfrac15+\frac{(-2)(2)}{10}=-\tfrac15,\\ \operatorname{Cov}(e_1,e_5) &=-4H_{15}=\tfrac45. \end{aligned}

원오차가 독립이어도 잔차는 의존할 수 있고 이 공분산은 양수입니다. 잔차를 새로운 독립 오차 표본으로 다루지 않습니다.

H15=−15,Cov⁡(e1,e5)=45.\begin{aligned} H_{15}&=-\tfrac15,\\ \operatorname{Cov}(e_1,e_5)&=\tfrac45. \end{aligned}

Independent original errors can produce dependent residuals, and this covariance is positive.

45. 잔차 제곱합의 기대값 증명Expected residual SS proof

고정 full-rank 단순 회귀에서 E[ε]=0, Cov(ε)=σ²I입니다. H는 rank 2 직교 투영입니다. E[SSE]=(n−2)σ²을 보이세요.

In fixed full-rank simple regression, E[ε]=0, Cov(ε)=σ²I and H is a rank-two orthogonal projector. Show E[SSE]=(n−2)σ².

풀이와 확인할 이유Solution and explanation
SSE=ε⊤(I−H)ε,E[SSE]=tr⁡{(I−H)σ2I}=σ2{n−tr⁡(H)}=(n−2)σ2.\begin{aligned} SSE&=\varepsilon^\top(I-H)\varepsilon,\\ E[SSE]&=\operatorname{tr}\{(I-H)\sigma^2I\}\\ &=\sigma^2\{n-\operatorname{tr}(H)\}\\ &=(n-2)\sigma^2. \end{aligned}

선형 평균은 (I−H)가 제거합니다. 이 기대값 증명에는 정규성이 필요 없지만 정확 독립 χ²와 t에는 필요합니다.

SSE=ε⊤(I−H)ε,E[SSE]=tr⁡{(I−H)σ2I}=σ2(n−2).\begin{aligned} SSE&=\varepsilon^\top(I-H)\varepsilon,\\ E[SSE]&=\operatorname{tr}\{(I-H)\sigma^2I\}\\ &=\sigma^2(n-2). \end{aligned}

The projector removes the linear mean. Normality is unnecessary for this expectation, but adds exact chi-square/t calibration.

46. 열 추가와 훈련 손실Adding a design column

기존 설계열을 모두 유지하며 새 설명열을 추가하면 최소 훈련 SSE가 커질 수 있나요?

Keeping every original design column and adding another, can minimum training SSE increase?

풀이와 확인할 이유Solution and explanation

최솟값은 커지지 않습니다. 새 계수를 0으로 두면 기존 모든 적합을 재현할 수 있어 후보 집합이 포함되기 때문입니다. 새 자료 손실·인과 식별·변수 선택의 오류 관리가 좋아진다는 결론은 없습니다.

No. Setting the new coefficient to zero reproduces every old candidate, so the feasible fit set expands. This proves nothing about new-data loss, causality or selection-adjusted inference.

47. 회귀 F와 t²Regression F and t squared

단순 절편 회귀의 n=5, SST=36/5, SSE=4/5입니다. 기울기 0 전체 F와 t² 연결을 구하세요.

For simple intercept regression, n=5, SST=36/5, SSE=4/5. Find the zero-slope F and its t² link.

풀이와 확인할 이유Solution and explanation
SSR=SST−SSE=325,F=SSR/1SSE/(5−2)=24,t2=24.\begin{aligned} SSR&=SST-SSE=\tfrac{32}5,\\ F&=\frac{SSR/1}{SSE/(5-2)}=24,\\ t^2&=24. \end{aligned}

같은 고전 모형의 기울기 0에 대한 F₁,₃와 양쪽 t₃는 같은 참고 p를 줍니다. HC1 점근 정규와는 다른 기준입니다.

SSR=325,F=SSRSSE/3=24=t2.\begin{aligned} SSR&=\tfrac{32}5,\\ F&=\frac{SSR}{SSE/3}=24=t^2. \end{aligned}

The classical F₁,₃ and two-sided t₃ share a reference p, unlike an HC1 asymptotic-normal procedure.

48. HC1과 의존HC1 and dependence

같은 점포의 반복 관측 오차가 서로 상관되어 있습니다. HC1을 선택하면 모든 공분산이 자동 반영되나요?

Repeated records from the same store have correlated errors. Does HC1 automatically include every covariance?

풀이와 확인할 이유Solution and explanation

아닙니다. 개별 잔차 제곱으로 만든 HC1은 오차 간 교차 곱을 일반적으로 반영하지 않습니다. 군집·시계열 구조와 충분한 독립 단위 등 그에 맞는 추론 조건을 설계해야 합니다. 평균 모형 오류나 인과 문제도 별도입니다.

No. Individual residual squares generally omit cross-error products. Design dependence-aware inference with appropriate independent-unit conditions; mean misspecification and causal identification remain separate.

49. 개인 자료의 분모Person-data denominator

실제 3613개 기록 중 3010개 로그 임금이 가용합니다. 두 모수 회귀의 잔차 자유도와 유지할 결측 수를 구하세요.

Among 3613 actual records,3010 source log wages are available. Find two-parameter residual df and the preserved missing count.

풀이와 확인할 이유Solution and explanation

잔차 자유도는 3010−2=3008, 결측은 603개입니다. 3613−2를 가용 로그 SSE의 분모로 쓰거나 결측을 로그값 0으로 채우지 않습니다.

Residual df=3008 and missing count=603. Do not divide available-log SSE by 3611 or impute zero logs.

50. 로그 기울기의 비율 해석Interpret a logged slope

적합 로그 임금 기울기 b=0.0520942366입니다. 학력 좌표가 1 증가할 때 적합 로그값·지수화한 중심의 비를 쓰세요.

The fitted log-wage slope is b=.0520942366. State the fitted log change and ratio of exponentiated fitted centers for one extra schooling unit.

풀이와 확인할 이유Solution and explanation

로그 적합값은 b만큼 증가하고 지수화한 두 적합값의 비는 exp(b)입니다. 비율 변화는 exp(b)−1이며 작은 b에서 약 5.21%로 근사할 수 있습니다. 이는 기하 중심의 적합 대비이지 산술 평균 임금의 인과 교육 수익률은 아닙니다.

The log fit changes by b and the exponentiated-center ratio is exp(b), with relative change exp(b)−1. The first-order approximation is about 5.21%, not an identified causal arithmetic-mean wage return.

51. 국가 GDP 좌표의 단위Country GDP coordinate

국가 직선에서 x=1인당 실질 GDP(2015 USD)/10000, b=1.7395884입니다. 1000 USD 차이의 적합 기대수명 대비는 무엇인가요?

A country line uses x=GDP per capita in constant 2015 USD divided by 10000 and b=1.7395884. What fitted life-expectancy contrast corresponds to 1000 USD?

풀이와 확인할 이유Solution and explanation

x 차이가 0.1이므로 적합 대비는 0.17395884년입니다. 이는 16개 국가를 같은 비중으로 맞춘 기술 직선이며 GDP를 1000 늘리는 정책이나 개인의 수명 증가를 식별하지 않습니다.

The x contrast is .1, so the fitted contrast is .17395884 years. It is an equal-country descriptive contrast, not an identified policy or individual-lifespan effect.

52. 두 SE의 실제 비교Compare actual SEs

국가 기울기 1.7395884의 고전 SE는 0.3675473, HC1 SE는 0.3871951입니다. 점추정이 달라진 건가요?

A country slope 1.7395884 has classical SE .3675473 and HC1 SE .3871951. Has its point estimate changed?

풀이와 확인할 이유Solution and explanation

아닙니다. 같은 관측 OLS 계수에 다른 분산 추정을 사용한 것입니다. 고전 t와 HC1 점근 정규의 기준까지 다름을 밝혀야 하며 두 SE 중 작거나 유의한 쪽만 고르는 기준을 사후 만들지 않습니다.

No. One OLS coefficient has two variance references. Also disclose classical t versus HC1 asymptotic normal rather than selecting the more favorable SE after inspection.

53. 같은 수치 제품 행Identical numerical product rows

1599개 실제 와인 기록 중 전체 수치가 서로 다른 행은 1359개입니다. 추가 동일 행 수와 보존 시 잔차 자유도를 구하세요.

Among 1599 actual wine records,1359 full numeric rows are distinct. Find additional identical rows and residual df when all are retained.

풀이와 확인할 이유Solution and explanation

추가 동일 수치 행은 240개이고 전부 보존하면 df=1597입니다. 같은 수치가 곧 같은 생산자·실수 복제라는 증거는 아닙니다. 1359개로 바꾸면 원자료의 관측 가중치를 변경한 별도 분석입니다.

There are 240 additional identical rows and df=1597. Numeric equality does not verify a producer identity or erroneous duplicate. Reducing to 1359 changes observational weights.

54. 순서형 점수의 직선A line for ordinal quality

품질 점수 3,4,5,…를 수치 응답으로 회귀하면 5.7 같은 적합값이 나올 수 있나요? 그것이 새 전문가 관측인가요?

Can numeric regression on quality scores 3,4,5,… produce a fit such as 5.7, and is that a new expert observation?

풀이와 확인할 이유Solution and explanation

선택한 수치 제곱손실 직선은 소수 적합값을 줄 수 있습니다. 이는 파생 예측값이지 새 전문가 점수가 아닙니다. 순서형 간격의 실질 의미·범위 밖 값·다른 순서형 모형을 별도로 검토합니다. 임의 반올림은 다른 예측 규칙입니다.

The chosen squared-loss fit can be fractional, but is a derived prediction rather than a new observed expert score. Assess ordinal spacing, range and alternative models; rounding creates another prediction rule.

55. 조건부 평균과 직선의 확인Conditional sample means versus the line

같은 x=12인 가용 로그 임금의 관측 평균과 OLS 값이 다릅니다. 최소제곱 계산이 틀렸다는 뜻인가요?

An observed mean among available x=12 log wages differs from the OLS value. Does that prove the fit was computed incorrectly?

풀이와 확인할 이유Solution and explanation

일반적으로 아닙니다. OLS는 전체 자료의 직선 제한 제곱손실을 최소화합니다. 각 x의 관측 평균을 모두 통과할 필요가 없습니다. 직선 평균 모형의 적합성·표본 변동·선택을 진단할 계기는 됩니다.

No. OLS minimizes overall squared loss restricted to a line and need not interpolate each same-x observed mean. The discrepancy can motivate mean-model, variation and selection diagnostics.

56. 선택은 SE로 고쳐지나Does an SE fix selection

결측 603개 로그 임금이 소득·학력에 의존해 빠졌을 수 있습니다. HC1 SE를 쓰면 전체 모집단 평균 함수가 자동 식별되나요?

The 603 missing source log wages may depend on income and schooling. Does HC1 automatically identify the full-population mean function?

풀이와 확인할 이유Solution and explanation

아닙니다. HC1은 선택된 자료의 분산 추론에 관한 특정 도구입니다. 빠진 응답과 선택 모형을 추가로 알아야 전체 대상에 대한 식별을 논의할 수 있습니다. 가용 표본 직선과 전체 표적을 구별합니다.

No. HC1 is a variance-estimation tool, not identification of missing responses or the selection mechanism. Separate the available-record fit from the full-population target.

57. 유한 끝점의 표시 한계Finite endpoint display limits

기울기 SE≈5.7735×10³⁰⁷와 유한 t 임계값을 곱한 구간 끝점이 일반 숫자 범위를 넘었습니다. 이를 어떻게 표시해야 하나요?

Multiplying finite slope SE≈5.7735×10³⁰⁷ by a finite t critical value exceeds ordinary numeric endpoint range. How should it be reported?

풀이와 확인할 이유Solution and explanation

수학적으로 유한한 끝점의 표시 범위 초과라고 알려야 합니다. ±∞라는 수학적 구간이나 피벗 미정의와 구별합니다. 실습은 범위 밖 끝점을 비워 두고 별도 표시 범위 안내를 제공합니다.

As a mathematically finite endpoint beyond display range, distinct from an infinite interval or undefined pivot. The lab leaves that endpoint unprinted and adds a range flag.

58. 완벽한 직선의 피벗A perfect line and its pivot

x=(0,1,2,3), y=(1,3,5,7)에서 계수·SSE·이 실습의 t피벗을 설명하세요.

For x=(0,1,2,3), y=(1,3,5,7), state coefficients, SSE and this lab’s t-pivot status.

풀이와 확인할 이유Solution and explanation

절편 1, 기울기 2, SSE=0입니다. 수치 적합은 정확하지만 양의 잔차분산이 없어 이 실습의 기울기 t피벗은 미정의입니다. 모든 실제 미래 오차가 0이거나 계수가 확정됐다는 결론은 별도 근거 없이 나오지 않습니다.

Intercept one, slope two and SSE=0 give exact numerical interpolation. The positive-residual-variance t pivot is undefined, not proof of zero future error or certain coefficients.

59. 직교와 조건부 평균 0의 차이Orthogonality versus zero conditional mean

X가 −1,0,1 동일 확률, Y=X²이고 선형 잔차 U=Y−2/3입니다. E[U], E[XU], E[U|X=0]을 구하세요.

X is uniform on −1,0,1, Y=X² and linear-projection residual U=Y−2/3. Find E[U], E[XU] and E[U|X=0].

풀이와 확인할 이유Solution and explanation

앞의 둘은 0이지만 E[U|X=0]=−2/3입니다. 선형투영의 무조건 직교 조건은 모든 x에서 조건부 평균 0이라는 더 강한 모형을 뜻하지 않습니다.

The first two are zero but E[U|X=0]=−2/3. Unconditional projection orthogonality does not imply the stronger zero-conditional-mean model.

60. 마지막 회귀 보고A final regression report

실제 가용 로그 임금 n=3010에서 b̂≈0.0520942, 고전 SE≈0.00286971, HC1 SE≈0.00290688, R²≈0.0987365입니다. 표적·단위·가정·인과 한계를 포함해 보고하세요.

Actual available log wages have n=3010, b̂≈.0520942, classical SE≈.00286971, HC1 SE≈.00290688 and R²≈.0987365. Report target, units, assumptions and causal limits.

풀이와 확인할 이유Solution and explanation

예: ‘전체 3613개 중 가용 로그 임금 3010개를 보고 학력 연수에 절편 있는 OLS로 맞췄다. 기울기는 약 0.0520942 로그 단위/년이며 고전 SE와 HC1 SE는 각각 약 0.00286971,0.00290688이다. 가용 표본의 선형 요약과 작업 기준 추론이며, 교육 선택·원자료 절단·603개 결측·오차 모형 미검증 때문에 교육의 인과 수익률로 해석하지 않는다.’ 원자료 키·진단·범위도 함께 남깁니다.

Example: “We fitted intercept OLS of source log wages on reported schooling among 3010 available records out of 3613. The slope was about .0520942 log units/year, with classical SE .00286971 and HC1 SE .00290688. This is an available-record linear summary with working inference, not an identified causal schooling return given selection, trimming,603 missing logs and unverified error assumptions.” Preserve source keys, diagnostics and range.

자료와 출처Data and sources

실습에 추가한 실제 입력과 출처Additional observed lab inputs and provenance

실제 자료 사례Actual-data cases · 원자료·단위·결측·변환·출처Inputs, units, missingness, transformations and sources

자료별 확보일·원행 식별·단위·이용 조건은 출처 기록을 확인하세요. 학습 사본은 제공처의 현재 최신 자료와 다를 수 있습니다.Consult each source record for retrieval dates, row identifiers, units and terms. Teaching copies can differ from current provider releases.

자료사전·출처·이용 조건Data dictionary, sources and terms