조건부 평균·선형 투영·단순 OLSConditional means, linear projection and simple OLS
여섯 행의 조건부 평균에서 정확한 OLS·특이해·실제 자료까지From six-row conditional means to exact OLS, singular families and actual records
실습 6종 · 풀이 포함 연습문제 60개6 labs · 60 exercises with solutions
기초Foundations
1. 평균을 어디에서 계산할지부터 고른다1. Choose where to average before drawing a line
같은 연습 시간을 가진 학생들의 성과 변화가 서로 다를 때, 우리는 어떤 숫자를 예측값으로 쓸까요? 전체 학생의 평균 하나를 모든 사람에게 줄 수도 있고, 연습 시간이 같은 집단의 평균을 줄 수도 있으며, 시간이 늘어날 때마다 일정하게 올라가는 직선을 줄 수도 있습니다. 세 규칙은 계산법과 답하는 질문이 다릅니다.
이 장은 먼저 가정한 여섯 기록을 끝까지 계산하고 실제 국가·사람·점포 자료로 이동합니다. 목표는 회귀표의 계수를 외우는 것이 아니라, 조건부 평균·최선의 직선·표본 OLS가 어떤 대상과 조건을 갖는지 구별하는 것입니다. 직선의 기울기를 정확히 구했다는 사실만으로 연습·교육·정책의 인과효과를 알아낸 것은 아닙니다.
Students with the same practice time can have different performance changes. We could assign everyone one overall mean, assign the mean of students with the same practice time, or use a straight line that rises at a constant rate. These rules differ in both calculation and target.
Work through six explicitly hypothetical records before moving to actual country, person and establishment sources. The aim is to distinguish a conditional mean, a best linear projection and sample OLS, rather than memorize a regression table. An exactly calculated slope alone does not identify an effect of practice, schooling or policy.
기초Foundations
2. 여섯 가정 기록을 줄마다 읽는다2. Read the six assumed records row by row
X는 연습 시간, Y는 성과의 변화 점수라고 합시다. 변화이므로 −1처럼 음수일 수도 있습니다. 아래 숫자는 실제 학생 관측이나 무작위 실험이 아니라 계산 원리를 배우기 위해 만든 표입니다. 각 행에 같은 비중을 주고, 이 여섯 행을 전부 아는 유한 프레임으로 먼저 읽습니다.
전부 가정 · 행마다 비중 1/6
행
X · 시간
Y · 변화 점수
1
0
-1
2
0
1
3
1
0
4
1
2
5
2
3
6
2
5
X=0의 평균 Y는 0, X=1은 1, X=2는 4입니다. 전체 평균은 합 10을 여섯 행으로 나눈 5/3입니다. 전체 평균 하나는 모든 X에서 같은 값을 주지만, 집단 평균은 X가 알려졌다는 정보를 사용합니다. 이 차이를 그림과 손계산에서 먼저 확인하세요.
Let X be practice hours and Y a performance-change score; a change may be negative. These are constructed teaching values, not actual students or a randomized experiment. Give each row equal mass and initially regard all six as a completely known finite frame.
Wholly assumed · each row has mass 1/6
Row
X · hours
Y · change points
1
0
-1
2
0
1
3
1
0
4
1
2
5
2
3
6
2
5
Mean Y is 0 at X=0, 1 at X=1 and 4 at X=2. The overall total 10 divided by six is 5/3. One overall mean gives every X the same prediction; group means use the information that X is known. Verify this distinction by hand before fitting a graph.
기초Foundations
3. 알고 있는 표에 확률 법칙을 명시한다3. Declare a probability law for a known table
여섯 행 중 하나를 같은 확률로 뽑는 별도 법칙을 정의하면 각 행의 확률은 1/6이고 X=0,1,2의 확률은 각각 1/3입니다. 이제 E[Y]는 그 법칙에 따른 평균 5/3입니다. 이는 계산 실험을 위해 우리가 정한 법칙이지 실제 학생들이 그렇게 추출되었다는 증거가 아닙니다.
비중을 바꾸면 기대값도 바뀔 수 있습니다. X=0 집단에 절반, 나머지 두 집단에 각각 1/4을 주면 전체 Y 평균은 0×1/2+1×1/4+4×1/4=5/4입니다. X별 평균을 그대로 두어도 X가 얼마나 자주 나타나는지에 따라 전체 표적이 바뀝니다. 가중치를 바꾸는 실습에서는 이 법칙을 결과 옆에 적습니다.
Separately declare an equal-probability draw from the six rows. Each row has probability 1/6, so X=0,1,2 each have probability 1/3. E[Y] under this law is 5/3. It is a chosen computational law, not evidence that actual students were sampled that way.
Changing masses can change expectations. Give X=0 probability 1/2 and the other groups 1/4 each: the overall mean becomes 0×1/2+1×1/4+4×1/4=5/4. Group means remain fixed while the frequency of X changes the overall target. Record the selected law beside a weighted calculation.
기초Foundations
4. X가 주어졌을 때의 평균은 무엇인가?4. What is the mean when X is given?
조건부 평균 m(x)는 X=x라는 정보를 가진 집단에서 Y를 평균한 값입니다. 지금의 이산 유한 법칙에서는 P(X=x)가 양수인 세 x에서 분자·분모를 직접 셀 수 있습니다. X=1인 두 행은 Y=0,2이므로 m(1)=1입니다. 그 집단 안의 개별 결과가 모두 1이라는 뜻은 아닙니다.
m(x)=E[Y∣X=x]m(0)=0,m(1)=1,m(2)=4
같은 X를 가진 행의 가중치가 다르면 가중 결과 합을 그 집단의 양수 가중치 합으로 나눕니다. 가중치가 0인 행도 원 기록에는 남기지만 그 법칙의 양수 질량 지지집합에는 기여하지 않습니다. 분모가 0인 집단의 평균은 미정의이지 0점이 아닙니다.
The conditional mean m(x) averages Y among units for which X=x is known. In this finite discrete law, numerator and denominator are directly countable at the three positive-probability x values. The two X=1 rows have Y=0,2, so m(1)=1; their individual outcomes are not both equal to one.
m(x)=E[Y∣X=x]m(0)=0,m(1)=1,m(2)=4
With unequal row weights, divide the group’s weighted outcome total by its positive total weight. Zero-weight records remain in the source but contribute no positive probability support. A zero-denominator group mean is undefined, not a zero outcome.
학부 연결 · 선택Undergraduate bridge · optional
5. 왜 제곱오차에서는 집단 평균을 고를까?5. Why does squared loss choose the group mean?
X=1인 집단의 결과 0과 2에 예측 상수 c를 줍니다. c=0이면 평균 제곱오차는 (0²+2²)/2=2이고, c=1이면 (1²+1²)/2=1입니다. c=2도 오차 2입니다. 평균 1에서 멀어지는 만큼 손실이 더해지는 식으로 이유를 정확히 쓸 수 있습니다.
E[(Y−c)2∣X=x]=Var(Y∣X=x)+[m(x)−c]2
이 식에는 조건부 2차 모멘트가 유한하고 해당 조건부 평균이 정의되는 범위라는 조건이 있습니다. 제곱의 두 번째 항은 0 이상이므로 c=m(x)가 최솟값을 만듭니다. 손실을 절댓값으로 바꾸면 중앙값을 고르게 되므로 “평균이 늘 최선”이라는 무조건적 주장은 아닙니다. 이 장은 제곱손실을 명시해 사용합니다.
Assign constant c to outcomes 0 and 2 within X=1. At c=0 the mean squared loss is 2; at c=1 it is 1; at c=2 it returns to 2. The identity shows exactly how moving away from the mean adds loss.
E[(Y−c)2∣X=x]=Var(Y∣X=x)+[m(x)−c]2
Use the identity where the conditional mean exists and the conditional second moment is finite. The final square is nonnegative and vanishes at c=m(x). Absolute loss instead selects a median, so the mean is not unconditionally best under every criterion. This chapter explicitly uses squared loss.
학부 연결 · 선택Undergraduate bridge · optional
6. 연속 X에서는 같은 값의 행을 찾는 것만으로 충분할까?6. Is matching identical X values enough for continuous X?
실제 키·소득·가격처럼 X가 연속에 가까우면 표에 같은 X가 한 번씩만 나타날 수 있습니다. 각 행의 Y를 그 X의 평균이라고 부르면 보관 표는 완벽히 맞추지만, 그 값이 더 넓은 모집단의 m(x)를 추정한 것이라는 근거는 생기지 않습니다. 새로운 X에서 무엇을 할지도 정해지지 않습니다.
연속 분포에서 P(X=x)=0인 점은 이산 공식의 분모로 직접 나눌 수 없습니다. 조건부 기대값은 X의 정보로 표현되는 함수라는 관점에서 정의하며, 같은 법칙에서 거의 확실하게 같은 함수는 같은 조건부 기대값 버전으로 취급합니다. 이 측도적 설명은 STAT07·MATH24와 연결해 두 번째로 읽으세요. 현재 실습의 지지집합 밖 쿼리는 미정의로 남겨 이런 차이를 드러냅니다.
For nearly continuous height, income or price, each observed X may occur only once. Calling its observed Y a group mean fits the retained table perfectly, but does not establish an estimate of the wider population m(x), nor define behavior at a new X.
At a point with P(X=x)=0, the discrete conditional formula cannot simply divide by that probability. Conditional expectation is defined as a function of X’s information; versions agreeing almost surely under the law are equivalent. Link this second-pass measure-theoretic view to STAT07 and MATH24. The live finite-support query remains undefined outside its observed positive-weight support.
기초Foundations
7. 평균과 직선은 같은 완전쌍에서 계산한다7. Use one complete-pair set for means and the line
여섯 가정 기록의 마지막 Y=5를 가린 사본을 생각합시다. X=2의 가용 평균은 이제 남은 Y=3 하나에서 3이고, 가용 다섯 행의 평균 Y는 1입니다. 원래 여섯 행 평균 5/3이나 완전표의 m(2)=4와 다른 표적입니다. 보이지 않는 값을 0으로 바꾸거나 X 평균에는 여섯 행·Y 평균에는 다섯 행을 섞지 않습니다.
OLS에서 X와 Y의 평균·편차곱·편차제곱을 계산할 때도 같은 양수 가중치 완전쌍을 사용합니다. 원행·완전쌍·미관측 수를 따로 표시하고 버린 듯 숨기지 않습니다. 완전쌍에서 정확히 계산한 계수가 전체 원행이나 모집단의 같은 계수라는 주장은 선택·결측에 대한 추가 조건이 필요합니다.
Consider a copy of the teaching table that hides its last Y=5. The available mean at X=2 is now 3, and the five available Y values average 1. These differ from the complete frame mean 5/3 and m(2)=4. Do not replace the hidden value by zero or combine a six-row X mean with a five-row Y mean.
For OLS, calculate both means, the centered cross product and the centered square sum on one positive-weight complete-pair set. Display source, complete-pair and missing counts separately. An exact available-pair coefficient needs further selection/missingness conditions before it can represent the corresponding full-frame or population target.
기초Foundations
8. 실습 A · 조건부 평균과 가중치를 직접 바꾼다8. Lab A · Change conditional means and weights
여섯 행의 X·Y와 가중치를 바꿔 보세요. 먼저 집단별 가중 합과 분모를 확인한 뒤 m(x)와 집단 안의 제곱오차를 읽습니다. 전체 평균과 조건부 평균을 구별하고, 같은 X를 서로 다른 소수·분수 표기로 적어도 정확히 같은 수이면 같은 집단으로 묶이는지 확인합니다.
Y 한 칸을 비워 가용 분모의 변화를 확인하고, 그 행의 가중치를 0으로 둔 경우와 비교합니다. 쿼리 X를 관측 지지집합 밖에 넣으면 조건부 평균을 자동으로 직선 보간하지 않습니다. 이 실습의 법칙은 명시한 유한 기록의 비중이며 실제 경제 자료의 추출 설계를 증명하지 않습니다.
Change X, Y and the row weights. Inspect each group’s weighted total and denominator before reading m(x) and its within-group squared loss. Distinguish the overall mean from group means, and check that equivalent fraction/decimal X representations merge exactly.
Leave a Y blank and compare the changed available denominator with giving that row zero weight. Query an X outside the observed support: the finite conditional mean does not silently interpolate a line. The declared finite masses do not establish an actual economic sampling design.
기초Foundations
9. 여러 집단을 한 직선으로 요약한다9. Summarize several groups with one line
직선 f(x)=a+bx에서는 X가 한 단위 늘 때 예측값이 b만큼 변합니다. 절편 a는 X=0에서의 직선값이며, 0이 관측 범위 밖이면 그 값을 실제 관측 평균처럼 읽지 않습니다. 여섯 표의 집단 평균 0,1,4는 기울기 1과 3으로 변하므로 한 직선이 세 평균을 모두 정확히 지나지는 못합니다.
그렇다고 직선을 사용할 수 없는 것은 아닙니다. 복잡한 관계를 정한 손실에서 단순하게 요약하려는 목표를 명시하면 됩니다. 아래에서 얻을 최선의 직선은 a=−1/3,b=2입니다. X=1에서 5/3을 주므로 집단 평균 1과 다릅니다. 이 차이는 계산 실수가 아니라 함수 집합을 직선으로 제한한 결과입니다.
For f(x)=a+bx, one additional X unit changes the line’s prediction by b. Intercept a is the line at X=0; when zero is outside observed support, it is not an observed group mean. The three teaching means 0,1,4 change with slopes 1 and 3, so no line passes through all three.
A line can still be a useful summary when its restricted function class and loss are explicit. The best line derived below has a=−1/3,b=2, predicting 5/3 at X=1 rather than its group mean 1. This discrepancy reflects the restriction to lines rather than an arithmetic mistake.
학부 연결 · 선택Undergraduate bridge · optional
10. 모집단 최선 직선이라는 표적을 정의한다10. Define the population best-line target
확률 법칙이 정해져 있고 X,Y의 2차 모멘트가 유한하다고 합시다. 그 법칙에서 평균 제곱손실을 가장 작게 하는 직선의 계수를 선형 투영 계수라고 정의합니다. 여기서 선형은 절편을 포함하는 아핀 함수의 통상적 회귀 명칭입니다. 이 정의는 m(x)가 실제 직선이라는 가정 없이도 사용할 수 있습니다.
R(a,b)=E[(Y−a−bX)2](a∗,b∗)∈arga,b∈RminR(a,b)
유일성을 위해서는 X에 양의 분산이 필요합니다. 분산이 0이면 여러 계수쌍이 같은 손실을 만들 수 있으므로 argmin을 집합으로 읽어야 합니다. 법칙이 달라지면 특히 비선형 m(x)를 요약하는 직선의 표적도 달라질 수 있습니다. 실제 표본으로 그 표적을 추정하는 단계는 이 정의와 별개입니다.
Assume a specified law with finite second moments for X and Y. Define linear-projection coefficients as those minimizing mean squared loss under that law. In regression terminology, the line includes an intercept, so its function is affine. The definition does not require the actual m(x) to be linear.
R(a,b)=E[(Y−a−bX)2](a∗,b∗)∈arga,b∈RminR(a,b)
Uniqueness requires positive variance of X. With zero variance, multiple coefficient pairs can give the same loss, so argmin is a set. A changed law can change the target line, especially when m(x) is nonlinear. Estimating this target from an actual sample is a separate stage.
학부 연결 · 선택Undergraduate bridge · optional
11. 잔차의 두 균형 조건을 유도한다11. Derive the two residual balance conditions
U=Y−a−bX로 놓고 제곱손실을 a,b에 대해 미분하면 아래 두 조건이 나옵니다. 유한 표에서는 합을 항마다 미분하면 되고, 모집단 표현은 유한 2차 모멘트가 있는 이차식의 계수를 이용해 정당화할 수 있습니다. 첫 조건은 잔차 평균 0, 둘째는 X와 잔차의 편차 없는 곱 평균 0입니다.
∂aR=−2E[U]=0∂bR=−2E[XU]=0
손실이 계수의 볼록 이차식이므로 가능한 계수에서 정규방정식을 만족하면 전역 최소가 됩니다. 양의 X 분산은 그 이차식이 두 계수를 유일하게 정하게 합니다. 이 균형은 최소제곱 정의에서 얻은 모멘트 조건이지 U가 X와 독립이거나 모든 X에서 조건부 평균 0이라는 증명은 아닙니다.
Write U=Y−a−bX and differentiate squared loss with respect to a and b. In a finite table, differentiate term by term; finite second moments justify the population quadratic coefficients. The first condition sets mean residual to zero, and the second sets the uncentered X-residual product mean to zero.
∂aR=−2E[U]=0∂bR=−2E[XU]=0
The loss is a convex quadratic in the coefficients, so a feasible solution to these normal equations is a global minimum. Positive X variance gives a unique coefficient pair. These moments follow from the least-squares definition; they do not prove independence or zero conditional mean at every X.
학부 연결 · 선택Undergraduate bridge · optional
12. 기울기는 편차곱을 X의 편차제곱으로 나눈다12. Divide centered cross variation by X variation
첫 정규방정식은 a=E[Y]−bE[X]를 줍니다. 이것을 둘째 식에 넣으면 X의 평균을 뺀 편차와 Y 편차의 곱이 남습니다. X 편차제곱 평균이 양수인 경우에만 그 값으로 나누어 기울기를 정할 수 있습니다. 편차곱의 부호가 양수이면 같은 방향의 움직임이 직선 요약에서 우세하다는 뜻입니다.
VX=E[(X−EX)2]>0CXY=E[(X−EX)(Y−EY)]b∗=VXCXY
여섯 표에서는 X 평균 1, Y 평균 5/3입니다. 편차곱 합은 8, X 편차제곱 합은 4이므로 b=2입니다. 같은 여섯 행에서 양쪽을 모두 6으로 나누면 비율은 같습니다. 서로 다른 가용 집합이나 분모로 계산한 분산·공분산을 섞으면 이 유도에 맞는 기울기가 아닐 수 있습니다.
The first normal equation gives a=E[Y]−bE[X]. Substitution into the second leaves the centered X–Y cross product. Divide by centered X variation only when it is positive. A positive cross product means same-direction movement dominates this linear summary.
VX=E[(X−EX)2]>0CXY=E[(X−EX)(Y−EY)]b∗=VXCXY
For the six rows, mean X is 1 and mean Y is 5/3. The centered cross-product sum is 8 and X square sum is 4, giving b=2. Dividing both by six leaves the ratio unchanged. Mixing different available subsets or covariance/variance denominators need not reproduce this derivation.
기초Foundations
13. 절편과 세 집단의 예측을 검산한다13. Check the intercept and all three predictions
b=2를 평균 식에 넣으면 a=5/3−2×1=−1/3입니다. 따라서 예측은 X=0,1,2에서 −1/3, 5/3, 11/3입니다. 이 세 값과 집단 평균 0,1,4를 나란히 놓고 어떤 차이가 함수 제한에서 나왔는지 확인하세요. 직선은 평균점 (1,5/3)을 지나지만 모든 집단 평균을 지날 필요는 없습니다.
가정 표의 조건부 평균과 최선 직선
X
조건부 평균 m(x)
직선값
m(x)−직선값
0
0
−1/3
1/3
1
1
5/3
−2/3
2
4
11/3
1/3
절편이 음수여도 계산이 틀렸다는 뜻은 아닙니다. 여기 Y는 변화 점수라 음수를 허용했습니다. 실제 양수 금액을 예측하는 다른 문제라면 음수 예측이 의미에 맞는지 별도로 점검하고 함수나 손실을 재설계해야 합니다. 계수의 산술과 결과 변수의 허용 범위는 함께 읽어야 합니다.
Substitute b=2 into the mean equation: a=5/3−2×1=−1/3. Predictions at X=0,1,2 are −1/3, 5/3, 11/3. Compare them with group means 0,1,4 to see the effect of the restricted function class. The line passes through mean point (1,5/3), not necessarily every group mean.
Conditional means and best line in the assumed table
X
Conditional mean m(x)
Line value
m(x) minus line
0
0
−1/3
1/3
1
1
5/3
−2/3
2
4
11/3
1/3
A negative intercept is not automatically an arithmetic error: Y here is a signed change score. For a different strictly positive monetary outcome, check whether negative predictions fit the substantive task and reconsider the function/loss if needed. Read the arithmetic together with the outcome’s allowed range.
학부 연결 · 선택Undergraduate bridge · optional
14. 같은 표에서 두 종류의 오차를 나눈다14. Separate two kinds of error in the same table
조건부 평균을 써도 각 집단의 두 결과는 평균에서 ±1 떨어져 있습니다. 이 법칙의 최소 조건부 평균 예측 손실은 1입니다. 직선으로 제한하면 세 집단의 평균과 직선 사이에 추가 간격 1/3, −2/3, 1/3이 생기고, 그 제곱의 평균은 2/9입니다.
첫 항을 이 정보 X에서의 불가피한 제곱손실이라고 부를 수 있지만, 더 많은 유용한 정보 Z를 관측하면 그 최솟값이 달라질 수 있습니다. 둘째 항은 여기서 선택한 직선 함수 집합의 근사 손실입니다. 이 구분을 실제 모집단에 적용하려면 어떤 정보와 법칙의 조건부 평균인지 명시해야 합니다.
Even the conditional means leave two outcomes ±1 from each group mean, so the best conditional-mean risk is 1. Restricting predictions to a line adds group-mean gaps 1/3, −2/3, 1/3; their mean square is 2/9.
The first term is irreducible relative to this information X, but observing useful additional information Z can change its minimum. The second term is approximation loss for the selected line class. A population interpretation must specify the information and law defining its conditional mean.
학부 연결 · 선택Undergraduate bridge · optional
15. 직교한다고 조건부 평균이 모두 0일까?15. Does orthogonality imply conditional mean zero?
최선 직선의 잔차 U=Y−a−bX는 전체 평균 0이고 X와의 곱 평균도 0입니다. 그러나 X별 잔차 평균은 위 표의 1/3, −2/3, 1/3입니다. 각각 0이 아니어도 (1/3)×[1/3−2/3+1/3]=0이고 X를 곱한 평균도 0입니다. 모멘트 두 개의 상쇄가 세 조건부 평균을 모두 0으로 만들지는 않습니다.
반면 ε=Y−m(X)는 정의한 조건부 평균 아래 E[ε|X]=0입니다. 유한 2차 모멘트와 적절한 적분가능성이 있으면 E[εh(X)]=0인 더 넓은 직교 관계가 따릅니다. 이 장의 투영 잔차 U와 조건부 평균 오차 ε를 같은 기호·가정으로 조용히 바꾸지 않습니다. “잔차가 X와 상관없다”는 표본 계산은 인과 외생성을 입증하지 않습니다.
For the best line, residual U has overall mean zero and zero mean product with X. Yet its conditional means are 1/3, −2/3, 1/3. Their equally weighted average is zero, and multiplying by X also cancels. Two moment restrictions do not force all three conditional means to vanish.
By contrast, ε=Y−m(X) satisfies E[ε|X]=0 under the conditional-mean definition. With appropriate second-moment/integrability conditions, the broader relation E[εh(X)]=0 follows. Keep the linear-projection residual U distinct from ε; a sample residual’s lack of correlation with X does not establish causal exogeneity.
기초Foundations
16. 실습 B · 직선과 모든 특이해를 확인한다16. Lab B · Inspect the line and every singular solution
먼저 같은 여섯 행에서 a=−1/3,b=2와 MSE=11/9를 재현하세요. 절편 포함을 끄면 다른 함수 집합에서 다시 최적화합니다. 이때 잔차 합이 0이 아닐 수 있으며 절편 포함 식을 그대로 적용하지 않습니다. 원자료의 결측·가중치·쿼리를 바꿀 때 가용 분모도 함께 읽습니다.
모든 양수 가중치 X를 2로 바꿔 보세요. a+2b가 Y 평균이면 여러 직선이 같은 최소 손실을 가집니다. 화면에 고른 대표 기울기가 유일한 답이라는 뜻은 아닙니다. X=2에서의 예측은 같지만 다른 쿼리 X에서는 최적 계수 가족 전체의 예측이 모든 실수가 될 수 있습니다. 그 범위는 신뢰구간이 아니라 이 특이한 최적화 문제의 해 집합입니다.
First reproduce a=−1/3,b=2 and MSE=11/9. Disable the intercept to optimize over a different function class; the residual sum need not be zero, so do not reuse intercept-model identities unconditionally. Read available denominators as missingness, weights or queries change.
Set all positive-weight X values to 2. Every line satisfying a+2b=mean Y has the same minimum loss. A displayed representative slope is not unique. Predictions agree at X=2, but the minimizing coefficient family can predict any real number at another X. This is an optimization solution set, not a confidence interval.
학부 연결 · 선택Undergraduate bridge · optional
17. 표본 OLS는 주어진 행에 적용하는 계산 규칙이다17. Sample OLS is a rule applied to the observed rows
앞에서는 여섯 행 전체를 알고 있는 법칙을 정의했습니다. 이제 더 큰 모집단에서 어떤 과정으로 여섯 행을 얻었다고 생각해 봅시다. 표본 OLS는 받은 행들의 잔차 제곱합을 최소화하는 규칙입니다. 입력 표가 같으면 산술 답은 같지만, 어떤 모집단을 대표하는지와 반복 표집의 분포는 자료 생성 과정에 달려 있습니다.
(a,b)∈arga,bminn1i=1∑n(yi−a−bxi)2
양의 정수 n개 가용 쌍을 같은 비중으로 사용하고 절편을 포함한다고 합시다. X의 표본 변동이 양수이면 중심화한 곱의 합을 X 중심 제곱합으로 나눈 값이 기울기입니다. 이 계산 자체에는 정규분포나 무작위 배정이 필요하지 않습니다. 반면 불편성·표준오차·인과 해석에는 별도 조건이 필요합니다. ‘구할 수 있다’와 ‘그 대상을 잘 추정한다’를 구별합니다.
Previously the six rows defined a fully known law. Now imagine obtaining rows from a larger population. Sample OLS is the rule that minimizes squared residuals in the received table. The same table gives the same arithmetic answer, but its population target and repeated-sampling distribution depend on how observations arose.
(a,b)∈arga,bminn1i=1∑n(yi−a−bxi)2
For a positive integer n of equally weighted available pairs and an intercept, positive sample X variation identifies the slope as the centered cross-product sum divided by the centered X square sum. This calculation alone needs neither normality nor random assignment. Unbiasedness, standard errors and causal interpretation require additional assumptions. A computable statistic is not automatically a valid estimator of every proposed target.
학부 연결 · 선택Undergraduate bridge · optional
18. 가중치가 바뀌면 어떤 직선이 최선인지도 바뀐다18. Changing weights can change the best line
가용 완전쌍의 비음수 가중치를 wᵢ라고 하고 그 합 W가 양수라고 합시다. 가중 평균·분산·공분산은 모두 같은 가용 쌍과 같은 가중치를 사용해야 합니다. w=0인 행은 표에 남아 있어도 이 목적함수에는 기여하지 않습니다. 모든 가중치를 같은 양수 배로 바꾸면 정규화된 손실과 최적 계수는 같습니다.
여섯 가정 행에 차례로 (2, 2, 1, 1, 1, 1)을 주면 X 집단 비중은 1/2, 1/4, 1/4입니다. 평균 X=3/4, 평균 Y=5/4, 분산 X=11/16, 공분산=21/16이어서 기울기 21/11, 절편 −2/11을 얻습니다. 원래 −1/3과 2가 틀린 것이 아닙니다. 최소화하는 법칙이 달라졌습니다. 이 장의 실제 자료 가중치 1은 기술적 선택이며 공식 조사 가중치나 대표성 보증이 아닙니다.
Let nonnegative weights on available complete pairs sum to W>0. Weighted means, variance and covariance must use that same subset and those same weights. A zero-weight row remains visible but contributes nothing to this objective. Multiplying all weights by one positive constant preserves the normalized loss and minimizers.
Weights (2, 2, 1, 1, 1, 1) give X-group masses 1/2, 1/4, 1/4. Mean X=3/4, mean Y=5/4, variance X=11/16 and covariance=21/16, hence slope 21/11 and intercept −2/11. The former coefficients −1/3 and 2 were not erroneous; the target law changed. Actual-data working weights of one are descriptive choices, not official survey weights or guarantees of representation.
학부 연결 · 선택Undergraduate bridge · optional
19. 계수 두 개를 바꾸면 손실 표면 위를 이동한다19. Changing two coefficients moves across a loss surface
기울기만 좋게 보이는 직선을 고르지 말고 모든 잔차를 제곱해 더합니다. 여섯 가정 행에서 a=0,b=1이면 잔차는 −1,1,−1,1,1,3이며 제곱합은 14, MSE는 7/3입니다. a=−1/3,b=2에서는 제곱합 22/3, MSE 11/9입니다. 둘의 차이 10/9가 목적함수 개선입니다.
실습의 손실은 Σw e²/W입니다. 다른 책이 1/2를 앞에 붙이면 최소점은 같지만 기울기 벡터와 Hessian의 수치는 절반이 됩니다. 서로 다른 정규화의 미분값을 섞지 마세요. Y가 변화 점수이면 MSE 단위는 점수², RMSE 단위는 점수입니다. 기울기 계수의 단위와 손실 단위도 서로 다릅니다.
두 미분이 0인 후보가 왜 전역 최소인지 다음 절의 정확한 손실 차이로 확인합니다. 단순히 그래프의 색이 가장 어둡다는 이유로 증명하지 않습니다.
Choose coefficients by the sum of all squared residuals, rather than visual appeal. At a=0,b=1 in the six assumed rows, residuals are −1,1,−1,1,1,3, giving SSE=14 and MSE=7/3. The best line gives SSE=22/3 and MSE=11/9: an improvement of 10/9.
The lab uses Σw e²/W. Adding a factor 1/2 leaves minimizers unchanged but halves the gradient and Hessian. Do not mix derivatives from different normalizations. For change-score Y, MSE has squared-point units and RMSE has point units, distinct from slope units.
분산 X가 양수이면 차이가 0이 되는 것은 두 계수 변화가 모두 0일 때뿐입니다. 여섯 행의 후보 (0,1)은 dₐ=1/3,d_b=−1, 평균 X=1, 분산 X=2/3이므로 (−2/3)²+2/3=10/9입니다. X가 상수이면 두 번째 항이 사라져 여러 계수 조합이 같은 예측을 만들 수 있습니다. 유일성 조건도 손실 차이에서 나옵니다.
Let a*,b* be an intercept-model minimizer and move to a*+dₐ,b*+d_b. Each residual changes by −(dₐ+d_bX). Expanding squares eliminates the cross-term by the two normal equations; the remaining weighted mean of squares cannot be negative.
With positive X variance, equality requires both coefficient changes to vanish. For candidate (0,1) in the six rows, dₐ=1/3,d_b=−1, mean X=1 and variance X=2/3 give (−2/3)²+2/3=10/9. Constant X removes the second term, allowing a family of coefficients with identical observed predictions. Uniqueness follows from the same identity.
학부 연결 · 선택Undergraduate bridge · optional
21. 잔차 직교는 계산에서 얻은 조건이다21. Residual orthogonality is a consequence of the calculation
여섯 행의 최적 직선 잔차는 (−2/3, 4/3, −5/3, 1/3, −2/3, 4/3)입니다. 합은 0이고 X를 각각 곱한 합도 0입니다. 잔차를 임의로 0에 맞춘 것이 아니라, 절편과 기울기에 대한 최소화가 이 두 항등식을 만듭니다. 가중 OLS에서는 w를 곱한 두 합이 0입니다.
그런데 X별 잔차 평균은 1/3, −2/3, 1/3입니다. 전체 두 직교 조건이 모든 집단에서 평균 0이라는 더 강한 조건을 보장하지 않는 실제 반례를 이미 갖고 있습니다. 무작위 표본을 가정하더라도 표본 잔차 합 0만으로 모집단의 구조 오차 조건부 평균 0을 검정하거나 증명할 수 없습니다.
i∑wiei=0i∑wixiei=0
실제 자료에서 이 합을 확인하는 일은 계산 검사에는 유용합니다. 교육의 인과효과나 정책 외생성의 인증서로 사용하지 않습니다.
The best-line residuals are (−2/3, 4/3, −5/3, 1/3, −2/3, 4/3). Their sum and their X-weighted sum are zero. These identities follow from minimizing over an intercept and a slope, rather than manually forcing residuals to cancel. Weighted OLS uses the corresponding w-weighted sums.
Yet residual means within X groups are 1/3, −2/3, 1/3. Two overall orthogonality conditions therefore do not imply zero mean in every group. Even with random sampling, a zero sample residual sum cannot establish a zero conditional mean for an unobserved structural disturbance.
i∑wiei=0i∑wixiei=0
Checking these sums is useful arithmetic QA on actual data; it does not certify schooling causality or policy exogeneity.
기초Foundations
22. 절편을 포함한다는 조건을 생략하지 않는다22. Do not omit the intercept condition
절편이 있으면 직선은 가중 평균점 (평균 X,평균 Y)을 지납니다. 이유는 a=평균 Y−b평균 X입니다. 원점을 반드시 통과하게 제한하면 a를 자유롭게 바꿀 수 없으므로 절편 정상방정식을 요구할 수 없습니다. 두 모형은 같은 최적화 문제가 아닙니다.
가정한 두 행 (X,Y)=(1,2),(2,3)을 보세요. 절편 포함은 Y=1+X로 잔차 0을 만듭니다. 원점 회귀의 기울기는 (1×2+2×3)/(1²+2²)=8/5입니다. 잔차 2/5,−1/5의 합은 1/5이고 X를 곱한 합만 0입니다. Y 평균 5/2와 예측 평균 12/5도 다릅니다.
X=0에서 Y=0이어야 한다는 실질 제약이 있는지 먼저 묻습니다. ‘절편은 보기 싫다’는 이유로 지우면 평균점 통과와 중심 SST 분해를 잃을 수 있습니다. 선형 투영의 ‘선형’은 절편을 포함한 아핀 함수까지 가리키는 관행이 있으므로 이 장은 절편 여부를 항상 표시합니다.
With an intercept, the fitted line passes through the weighted mean point because a=mean Y−b mean X. Forcing the line through the origin prevents free adjustment of a, so its normal equation no longer applies. These are different optimization problems.
For assumed rows (1,2),(2,3), the intercept model Y=1+X fits exactly. Through-origin regression gives b=(2+6)/(1+4)=8/5. Residuals 2/5,−1/5 sum to 1/5, while their X-weighted sum is zero. Mean Y=5/2 also differs from mean prediction 12/5.
Ask whether Y must substantively vanish at X=0. Removing an intercept for visual preference can lose the mean-point and centered-SST identities. Since “linear projection” often includes affine functions, this chapter always states whether an intercept is fitted.
기초Foundations
23. 모든 Y가 같으면 R²의 분모가 사라진다23. Constant outcomes remove the R² denominator
가정 행 X=(0,1,2),Y=(5,5,5)에서는 절편 포함 최적 직선이 a=5,b=0이고 잔차가 모두 0입니다. Y 중심 제곱합 SST도 0입니다. 따라서 1−SSE/SST는 1−0/0이므로 정의되지 않습니다. 완벽하게 예측했다는 일상 표현과 이 특정 비율의 정의 여부를 구별합니다.
상수 Y의 경우에도 X가 변하면 기울기 0은 유일합니다. 반면 X와 Y가 모두 상수이면 여러 계수가 같은 상수 예측을 만들 수 있습니다. Y가 상수라는 사실과 X 설계가 특이하다는 사실은 별개의 조건입니다.
화면에서 미정의를 0이나 1로 강제로 채우지 마세요. 한편 모든 가중치가 0이거나 가용 완전쌍이 없다면 정규화된 평균 자체를 계산할 수 없다는 더 앞선 문제가 생깁니다. 입력의 분모가 왜 없는지부터 구분해 오류 상태를 읽습니다.
For assumed X=(0,1,2),Y=(5,5,5), the intercept-model optimum is a=5,b=0 with zero residuals. Centered SST is also zero, so 1−SSE/SST is undefined, not automatically one. Perfect prediction in everyday language and the definition of this particular ratio are different questions.
Constant Y still gives a unique zero slope when X varies. If both X and Y are constant, a coefficient family produces the same constant prediction. Constant outcomes and a singular X design are separate conditions.
Do not replace undefined ratios with zero or one. With all weights zero or no available complete pair, even a normalized mean has no denominator. Read the reason for an undefined result before interpreting a number.
기초Foundations
24. 실습 C · 후보 계수와 최적값의 차이를 증명한다24. Lab C · Verify the gap between a candidate and the optimum
여섯 가정 행에서 (a,b)=(0,1)을 입력해 후보 손실 7/3, 최적 손실 11/9, 차이 10/9를 확인하세요. 계수 변화로 계산한 이차식과 직접 잔차로 계산한 차이가 정확히 같은지 봅니다. 화면의 소수보다 정확 분수를 먼저 비교합니다.
다음에는 모든 X를 2로 바꾸고 b를 바꿀 때 a=평균 Y−2b로 함께 조정하세요. 계수는 움직이지만 차이가 0인 골짜기를 얻게 됩니다. 절편을 끄면 a=0이 고정되고 비교 대상도 바뀝니다. 유효 쌍이 없는 입력은 손실을 0으로 보고 통과시키는 예가 아니라 분모가 없는 예입니다.
Enter candidate (a,b)=(0,1) for the six assumed rows. Check candidate loss 7/3, minimum 11/9 and gap 10/9. Compare the exact quadratic gap from coefficient changes with direct squared residuals; inspect fractions before rounded decimals.
Then set every X to 2 and adjust a=mean Y−2b as b changes. Coefficients move along a zero-gap valley. Disabling the intercept fixes a=0 and changes the comparison problem. No available pairs is an absent denominator, not a valid zero-loss result.
학부 연결 · 선택Undergraduate bridge · optional
25. 그림의 세로 잔차와 관측공간의 직교를 구별한다25. Separate vertical plot errors from observation-space orthogonality
산점도에서 OLS는 각 X를 고정하고 Y 방향의 차이를 제곱합니다. 점에서 기울어진 직선까지의 최단 수직거리를 최소화하는 문제가 아닙니다. X에도 같은 방식의 측정 오차를 허용하는 다른 목적함수는 다른 답을 낼 수 있습니다.
n개 관측을 벡터로 모으면 실제 Y=(y₁,…,yₙ)와 예측 a·1+b·X가 같은 n차원 공간에 놓입니다. 최적 잔차는 그 공간에서 상수 벡터와 X 벡터에 직교합니다. 양수 가중치 좌표로 제한하면 가중 내적은 Σwᵢuᵢvᵢ입니다. 양수 가중치 좌표에서의 기하를 먼저 생각하면, 0 가중치 좌표는 거리 계산에서 제외된다는 점도 보입니다.
⟨u,v⟩w=i∑wiuivi
여섯 행의 산점도는 2차원 설명 그림이고 잔차 직교는 여섯 좌표의 관측공간에 대한 명제입니다. 뒤의 행렬·FWL 장에서 이 공간을 더 일반화합니다.
In a scatterplot, OLS fixes each X and squares the vertical Y error. It does not minimize shortest perpendicular distances to the slanted plotted line. A different objective that treats measurement errors in X symmetrically may yield another answer.
Collect n outcomes into Y=(y₁,…,yₙ). Predictions a·1+b·X live in that n-dimensional observation space. The minimizing residual is orthogonal there to the constant and X vectors. Restricting to positive-weight coordinates gives the inner product Σwᵢuᵢvᵢ; zero-weight coordinates are excluded from this inner-product space.
⟨u,v⟩w=i∑wiuivi
The six-row scatterplot is a two-dimensional display; residual orthogonality is a statement in six-coordinate observation space. The later matrix/FWL chapter generalizes this geometry.
학부 연결 · 선택Undergraduate bridge · optional
26. 설명된 제곱과 남은 제곱을 같은 기준에서 더한다26. Add fitted and remaining squares using the same reference
절편 포함 최적 예측과 같은 가용 쌍·가중치를 사용하면 Y−평균 Y는 예측−평균 Y와 잔차의 합입니다. 두 벡터의 교차곱이 0이므로 전체 중심 제곱합은 설명 제곱합과 잔차 제곱합으로 나뉩니다.
여섯 행에서는 SST=70/3, SSR=16, SSE=22/3입니다. 따라서 SST가 양수일 때의 R²는 24/35입니다. 이 비율은 선택한 Y 변동을 그 표 안에서 얼마나 줄였는지 나타냅니다. 24/35만큼 교육 효과를 설명했다거나 새로운 학생을 그 비율로 정확하게 예측한다는 뜻은 아닙니다.
다른 표본이나 다른 가중치로 계산한 평균·제곱합을 섞으면 항등식이 성립할 이유가 없습니다. 시험 자료 예측의 SSE는 훈련 자료의 분해와도 다릅니다.
With an intercept optimum, the same available pairs and the same weights, Y−mean Y equals fitted-minus-mean plus residual. Their cross-product vanishes, producing the centered sum-of-squares identity.
The six rows give SST=70/3, SSR=16 and SSE=22/3, hence R²=24/35. This describes reduction of the chosen outcome variation within that table. It does not measure a fraction of an identified schooling effect or guaranteed accuracy on new students.
Mixing samples, weights or reference means breaks the derivation. Test-set prediction SSE is also different from this training-data identity.
기초Foundations
27. 원점 제약의 손실과 중심 R²는 다른 기준이다27. Origin constraints and centered R² use different references
절편 없는 모형에서 모든 X가 0이면 어떤 기울기도 예측을 바꾸지 못합니다. 예측은 모두 0이고 최소 MSE는 Y²의 평균입니다. Y 평균을 예측할 자유가 없으므로, 절편 포함의 평균 기준 손실보다 나쁠 수 있습니다.
가정 두 행 X=(1,2),Y=(2,3)에서 원점 회귀는 SSE=1/5입니다. Y 중심 SST=1/2이므로 1−SSE/SST=3/5라는 수를 계산할 수는 있습니다. 하지만 절편 포함의 중심 SSR+SSE 항등식은 이 직선에 자동 적용되지 않습니다. 어떤 소프트웨어는 원점 회귀에서 ΣY²를 분모로 한 비중심 R²를 따로 보고합니다. 이름이 같아도 기준을 확인해야 합니다.
이 장의 실습은 손실·잔차·최소해를 우선 공개합니다. 무절편의 통계량을 절편 포함 모형과 같은 해석으로 비교하지 않습니다. 모형 제약은 계산 옵션이면서 실질 가정입니다.
Without an intercept, all-zero X means every slope predicts zero. Minimum MSE is mean Y² because predicting mean Y is not available. It can exceed the intercept-model mean baseline.
For assumed X=(1,2),Y=(2,3), the origin fit has SSE=1/5. Centered SST=1/2 gives the calculable ratio 1−SSE/SST=3/5, but the intercept-model centered SSR+SSE identity need not hold. Software may instead report an uncentered R² using ΣY². Always inspect the denominator, even when the statistic has the same name.
The lab prioritizes objective values, residuals and complete minimizer sets. Do not interpret origin-model summaries as automatically interchangeable with intercept-model summaries. A constraint is both a computational option and a substantive assumption.
학부 연결 · 선택Undergraduate bridge · optional
28. X가 상수이면 계수 한 쌍이 아니라 직선 가족이 답이다28. Constant X identifies a coefficient family rather than one pair
양수 가중치를 가진 모든 완전쌍의 X가 x₀이면 예측은 a+bx₀ 한 값입니다. 그 값이 평균 Y일 때 제곱손실이 최소입니다. b를 어떤 실수로 고르고 a=평균 Y−bx₀로 맞추어도 같은 적합값과 손실을 얻습니다.
{(a,b):a=yˉw−bx0,b∈R}
가정 X=(2,2),Y=(3,5)이면 최소 평균 예측은 4, 최소 MSE는 1입니다. (a,b)=(4,0),(2,1),(0,2)는 모두 답입니다. 컴퓨터가 b=0을 대표로 선택해 보여주어도 데이터가 유일한 기울기 0을 식별한 것은 아닙니다.
원래 표에 다른 X가 있어도 그 행의 가중치가 0이거나 Y가 결측이면 현재 목적함수의 X 변동을 회복하지 못합니다. 설계의 랭크는 실제로 손실에 기여하는 쌍에서 판단합니다.
If every positive-weight complete pair has X=x₀, every fitted prediction is a+bx₀. Squared loss is minimized when this equals mean Y. Any real b with a=mean Y−bx₀ gives the same fit and loss.
{(a,b):a=yˉw−bx0,b∈R}
Assumed X=(2,2),Y=(3,5) gives fitted mean 4 and minimum MSE=1. Coefficients (4,0),(2,1),(0,2) all minimize. A computer-selected representative b=0 does not mean the data uniquely identify a zero slope.
A different X on a zero-weight or missing-Y row does not restore variation for this objective. Assess rank on pairs that actually contribute to the loss.
학부 연결 · 선택Undergraduate bridge · optional
29. 특이한 원점 회귀에서도 전체 해를 보존한다29. Preserve the whole solution set in singular origin regression
절편 없이 ΣwX²가 양수이면 기울기 ΣwXY/ΣwX²는 유일합니다. X가 모두 같은 2라도 분모가 양수여서 기울기가 유일할 수 있습니다. 따라서 ‘X가 상수면 항상 기울기 미식별’이라는 문장은 절편 포함 조건을 빼면 틀립니다.
가정 X=(2,2),Y=(3,5)의 원점 회귀는 b=2이고 두 예측이 4입니다. 반면 X=(0,0),Y=(3,5)이면 모든 b가 예측 0을 만들고 MSE=(9+25)/2=17입니다. 임의 대표 b=0은 그 무한한 해 중 하나입니다.
실습의 ‘유일함’은 특정 모형과 특정 손실에 관한 판정입니다. 절편 유무를 바꾼 뒤 예전 판정을 그대로 가져오지 마세요. 실제 자료의 표본 크기가 크더라도 손실에 들어가는 X가 모두 0이면 이 문제는 남습니다.
Without an intercept, positive ΣwX² gives the unique slope ΣwXY/ΣwX². Even constant X=2 can therefore identify a unique slope. “Constant X always leaves the slope unidentified” is false without the intercept condition.
For assumed X=(2,2),Y=(3,5), the origin slope is b=2, predicting 4 twice. For X=(0,0),Y=(3,5), every b predicts zero and MSE=(9+25)/2=17. Representative b=0 is only one of infinitely many solutions.
Uniqueness concerns a particular model and objective. Reassess it after changing the intercept constraint. A large row count cannot rescue an origin design whose contributing X values are all zero.
기초Foundations
30. 표 밖의 질문과 계수 식별을 따로 읽는다30. Separate queries outside support from coefficient identification
상수 X=2의 절편 모형에서 최적 계수 가족은 a=4−2b입니다. 쿼리 x=2의 예측은 항상 4이지만 x=3에서는 4+b이므로 모든 실수가 가능합니다. 같은 관측 적합값을 만드는 직선들이 표 밖에서 다르게 갈라집니다.
여섯 가정 행처럼 X 변동이 양수라 직선이 유일해도, x=100의 값은 선택한 직선을 연장한 계산입니다. 실제로 관측한 X 범위가 0~2라는 사실이 사라지지 않습니다. 유일한 선형 투영이 참 조건부 평균의 함수 형태를 바깥까지 보장하지 않습니다.
실습은 대표 예측과 최소해 전체에서 그 예측이 유일한지를 함께 보여줍니다. ‘모든 실수’는 표본 불확실성 구간이 아닙니다. 반대로 대표 예측 하나가 표시되었다고 관측 밖의 현실을 정확하게 예측한 것도 아닙니다.
With constant X=2 and intercept-family a=4−2b, a query at x=2 always predicts 4. At x=3 it predicts 4+b, spanning every real number. Lines with identical observed fits diverge off support.
Even when varying X uniquely identifies a line, evaluating it at x=100 merely extends the selected function beyond the observed 0–2 range. A unique linear projection does not guarantee the true conditional-mean shape outside support.
The lab shows a representative prediction alongside its identification over all minimizers. “All real numbers” is not a sampling uncertainty interval. Conversely, one displayed extrapolation is not a certified prediction of reality.
기초Foundations
31. 행을 더하기 전에 어떤 법칙을 바꾸는지 묻는다31. Ask which law changes before adding observations
여섯 행에서 X=0의 두 기록을 한 번씩 더 복사하면 집단 비중이 1/2, 1/4, 1/4이 됩니다. 각 X의 Y 평균은 0,1,4로 그대로인데 최선의 기울기는 2에서 21/11로 바뀝니다. 이는 같은 비선형 조건부 평균을 다른 X 분포로 직선 요약한 차이입니다.
복사 행은 새로운 독립 학생이 아닙니다. 원래 행에 가중치 2를 주는 계산과 같을 뿐입니다. 실제 병합으로 특정 집단이 여러 번 복제되면 의도하지 않은 가중 표적을 만들 수 있습니다. DATA06의 키 결합 사례와 연결해 보세요.
모든 원행을 같은 횟수로 복제하면 정규화된 손실과 계수는 그대로입니다. 그러나 그 복사본을 독립 표본으로 간주해 표준오차를 줄이면 자료 생성 과정을 바꿔 주장하는 셈입니다. 행 수·정보량·표적분포를 구별합니다.
Copy the two X=0 rows once more. Group masses become 1/2, 1/4, 1/4 while conditional means remain 0,1,4. The best slope changes from 2 to 21/11 because the same nonlinear conditional mean is summarized under another X distribution.
Copies are not newly independent students; they implement weight two on existing rows. A join that duplicates selected groups can unintentionally change the projection target. Connect this to DATA06 keys and joins.
Repeating every row equally preserves normalized loss and coefficients, but treating copies as independent observations to reduce a standard error invents a sampling process. Distinguish row count, information and target distribution.
기초Foundations
32. 실습 D · 조건부 평균과 직선의 오차를 분리한다32. Lab D · Separate conditional noise from line approximation
실습은 완전하게 주어진 유한 가용 법칙에서 같은 X별 평균을 계산합니다. 여섯 행의 참조 집단 평균 0,1,4와 선형 예측 −1/3, 5/3, 11/3을 비교하세요. 선택 직선의 총 위험 11/9는 집단 내부 위험 1과 조건부 평균 근사 오차 2/9로 나뉩니다.
a=0,b=1로 바꾸면 총 위험은 7/3, 내부 위험은 그대로 1, 근사 오차는 4/3입니다. 내부 위험은 계수 변경으로 없앨 수 없습니다. 단, 실제 자료에서 같은 X의 반복이 거의 없으면 관측 집단 평균을 참 모집단 조건부 평균으로 부를 근거가 없습니다. 이 실습이 계산하는 유한 법칙과 미지 모집단을 구별합니다.
The lab computes same-X means under a completely supplied finite available law. Compare group means 0,1,4 with line predictions −1/3, 5/3, 11/3. Total risk 11/9 splits into within-group risk 1 and conditional-mean approximation risk 2/9.
At a=0,b=1, total risk is 7/3, within risk remains 1 and approximation risk is 4/3. Changing line coefficients cannot remove within-group risk. In actual data with almost no exact-X repetition, observed group means are not automatically the true population conditional expectation. Keep this finite-law calculation distinct from that unknown target.
기초Foundations
33. 단위를 바꾸면 기울기의 숫자가 바뀐다33. A change of units changes the numerical slope
여섯 가정 행의 X를 시간 대신 분으로 쓰면 X′=60X입니다. Y의 점수 단위는 그대로이므로 기울기 2점/시간은 1/30점/분이 됩니다. 절편 −1/3, 각 행의 예측과 잔차, MSE는 같습니다. 숫자 기울기가 작아졌다고 연관성이 약해진 것이 아닙니다.
이번에는 Y′=100Y로 점수를 100배 확대하면 절편과 기울기도 100배, 잔차도 100배, MSE는 10,000배입니다. R²처럼 같은 스케일의 제곱합을 나눈 비율은 Y 변동이 양수이고 절편을 포함할 때 그대로입니다. 반면 X와 Y의 단위를 섞은 거리나 기울기의 숫자는 그대로 비교하면 안 됩니다.
실제 국가 사례의 기울기는 기대수명 지표 1년당 2015년 불변 USD/명입니다. 이는 사람의 수명을 1년 늘리는 개입의 효과 단위가 아니라 선택 국가들의 기술적 직선 단위입니다. 단위 표기를 정확히 하는 일은 인과 해석을 새로 만들어 주지는 않습니다.
Replacing hours by minutes gives X′=60X. A slope of 2 points/hour becomes 1/30 point/minute, with intercept −1/3 and unchanged predictions, residuals and MSE. A smaller numerical slope does not imply a weaker association.
If Y′=100Y, the intercept, slope and residuals multiply by 100 while MSE multiplies by 10,000. A ratio such as R² stays invariant when its centered sums have a positive denominator and an intercept is included. Numerical slopes and mixed-unit distances are not invariant in the same way.
The actual country slope has units of constant-2015 USD/person per year of the longevity indicator. It is a descriptive line across selected countries, not the effect of an intervention that adds one year to a person’s life. Correct units do not create causal identification.
기초Foundations
34. 중심을 옮기면 절편의 질문이 바뀐다34. Centering changes the question answered by the intercept
X의 새 좌표를 X′=X−1로 두면 여섯 행의 평균 X′는 0입니다. 원래 직선 −1/3+2X는 5/3+2X′가 됩니다. 새 절편 5/3은 원래 X=1에서의 예측입니다. 원점만 이동했으므로 기울기·적합값·잔차는 변하지 않습니다.
Y도 평균 5/3을 빼면 Y′=Y−5/3이고 중심화 좌표의 직선은 2X′로 원점을 통과합니다. 이것은 원래 자료에서 임의로 절편을 0으로 강제한 것과 다릅니다. 먼저 같은 가용 쌍의 평균을 정확히 빼고, 원래 단위로 복원하는 절차가 필요합니다.
실제 기대수명 X=0은 관측 범위 밖입니다. 중심을 80년으로 옮기면 절편이 ‘기대수명 지표가 80년일 때 직선 예측’이라는 가까운 기준을 갖습니다. 그래도 관측 국가 간 연관이라는 범위는 같습니다.
Set X′=X−1 so mean X′ is zero in the six rows. The original line −1/3+2X becomes 5/3+2X′. Its new intercept is the prediction at original X=1; the slope, fitted values and residuals do not change.
Also set Y′=Y−5/3. The centered line becomes 2X′ through the origin. This differs from arbitrarily forcing the original intercept to zero: means must come from the same available pairs and predictions must be restored to original coordinates.
Actual longevity X=0 lies outside the country data. Centering at 80 years makes the intercept a line prediction at that closer reference, while retaining the same descriptive country-association interpretation.
학부 연결 · 선택Undergraduate bridge · optional
35. 일반 아핀 단위변환을 직접 유도한다35. Derive a general invertible affine transformation
X′=tₓ+sₓX, Y′=tᵧ+sᵧY라 하고 두 척도 sₓ,sᵧ가 모두 0이 아니라고 합시다. X=(X′−tₓ)/sₓ를 Y=a+bX에 대입해 새 절편과 기울기를 읽습니다. 절편 포함 모형에서의 식이며, 변환 후 절편을 강제로 제거하면 같은 함수 집합이 아닐 수 있습니다.
b′=sxsyba′=ty+sya−b′txei′=syeiL′=sy2L
두 척도가 0이 아니면 모든 직선 사이에 일대일 대응이 있습니다. 따라서 유일한 최적해뿐 아니라 상수 X에서의 전체 최소해 가족도 대응됩니다. X 척도를 0으로 만들면 정보를 없애므로 이 역변환 논리를 쓸 수 없습니다.
예를 들어 X′=10+2X, Y′=3+5Y이면 b′=5, a′=−146/3입니다. 각 행에서 변환 직선으로 예측한 뒤 Y=(Y′−3)/5로 복원하면 원래 예측과 같습니다. 큰 음의 새 절편도 좌표 이동의 결과일 수 있습니다.
Let X′=tₓ+sₓX and Y′=tᵧ+sᵧY with both scales nonzero. Substitute X=(X′−tₓ)/sₓ into Y=a+bX to obtain the new coefficients. This is an intercept-model identity; removing the transformed intercept may change the function class.
b′=sxsyba′=ty+sya−b′txei′=syeiL′=sy2L
Nonzero scales give a one-to-one mapping of lines, including every member of a singular minimizing family. A zero X scale destroys information, so the inverse argument fails.
For X′=10+2X,Y′=3+5Y, the six-row optimum becomes b′=5,a′=−146/3. Predicting in transformed units and restoring Y=(Y′−3)/5 recovers the original fits. A large negative new intercept can simply reflect the shifted coordinate origin.
기초Foundations
36. 음의 척도는 방향을 뒤집는 재표현이다36. A negative scale reverses coordinate orientation
보통 시간에서 분으로 바꾸는 단위변환의 척도는 양수입니다. 실습은 더 일반적인 아핀 좌표를 확인하려고 음의 척도도 허용합니다. X′=−X이면 숫자가 클수록 원래 X는 작습니다. 원래 기울기 2는 새 기울기 −2가 되지만 각 원행의 예측은 같습니다.
두 축을 모두 음수 배로 뒤집으면 기울기의 부호는 원래와 같습니다. 원래 상관계수가 정의된 경우, 그 부호는 sₓsᵧ의 부호를 따라 바뀌며 제곱상관은 유지됩니다. 이는 사람의 행동 효과가 반대로 바뀌었다는 뜻이 아니라 축의 순서를 바꾼 결과입니다.
실습 출력의 척도 0 오류를 회귀 계산 실패와 혼동하지 마세요. 역변환이 필요한 이 실습에서 0은 허용하지 않는 좌표 선택입니다. 원자료의 상수 X 문제는 별도 실습에서 해 가족으로 정확히 다룹니다.
Ordinary hour-to-minute unit changes use positive scales. The lab also allows negative scales to examine general affine coordinates. If X′=−X, larger new values mean smaller original X, so the slope becomes −2 while every original-row prediction remains unchanged.
Reversing both axes preserves the slope sign. When the original correlation is defined, it changes sign according to sₓsᵧ while squared correlation remains invariant. Coordinate reversal does not reverse a behavioral causal effect.
A rejected zero scale is an invalid choice for this invertible-coordinate lab, distinct from a constant-X regression. The latter is handled by its full minimizing family in the separate projection lab.
학부 연결 · 선택Undergraduate bridge · optional
37. 관측 범위와 질문 범위를 표에 함께 적는다37. Record both observed support and the query range
여섯 행의 X 범위는 0~2입니다. 직선에 X=3을 넣으면 17/3, X=100이면 599/3을 얻습니다. 계산은 명확하지만 실제 조건부 평균이 그 범위까지 같은 기울기라는 근거는 표에 없습니다. 심지어 관측 범위 안에서도 집단 평균 0,1,4는 직선과 다릅니다.
관측이 없는 X에서 조건부 평균의 버전을 어떻게 정할지와, 선택한 직선을 어디에서 평가할지는 다른 질문입니다. 연속 X에서는 개별 점의 확률이 0일 수 있으므로 ‘그 X의 관측 수로 나누기’만으로 모집단 조건부 평균을 정의하지 않습니다. 부드러움·함수 형태·지원집합 같은 조건을 따로 기록해야 합니다.
보고서에는 최소·최대 X, 관측이 모인 영역, 쿼리 X, 그 쿼리가 실제 관측인지 단순 연장인지를 적으세요. 표본 밖 예측 성능은 시간·단위가 맞는 별도 평가가 필요합니다.
The six rows have observed X range 0–2 and positive-mass support {0,1,2}. The fitted line gives 17/3 at X=3 and 599/3 at X=100. Arithmetic is unambiguous, but the table gives no evidence that the conditional mean keeps that slope there. Even within support, group means 0,1,4 differ from the line.
Choosing a conditional-mean version at unobserved X and evaluating a chosen line there are different tasks. With continuous X, a point may have probability zero; dividing by its observed count does not define the population conditional mean. State smoothness, functional-form and support assumptions separately.
Report the observed X range, concentrations of observations, query X and whether it is observed or extrapolated. Performance on new units or future dates needs a suitable separate evaluation.
학부 연결 · 선택Undergraduate bridge · optional
38. 같은 관측 직선에 다른 인과 이야기가 가능하다38. The same observed line can admit different causal stories
모든 관측에서 Y=X라고 합시다. 한 가정 세계는 X가 무작위로 정해지고 개입 결과가 Y(x)=x인 경우입니다. 다른 세계는 공통 요인 Z가 X=Z,Y=Z를 만들고 X만 강제로 바꿔도 Y=Z가 유지되는 경우입니다. 관측 직선은 두 세계에서 같지만 X 개입의 효과는 각각 1과 0입니다.
직선 회귀는 관측 분포의 함수입니다. 같은 관측 분포에 여러 반사실 구조가 들어갈 수 있다면 회귀 계산을 정밀하게 해도 그 차이를 없애지 못합니다. 교육 연수와 임금, 기대수명과 GDP, 이전 FTE와 이후 FTE에 적용할 때도 개입과 자료 생성 조건을 별도로 정해야 합니다.
그렇다고 관측 연관이 무의미한 것은 아닙니다. 기술·측정 점검·가정 점검·정해진 환경의 예측에 유용할 수 있습니다. 어떤 용도로 쓴 것인지 정확히 명명하고, 그보다 강한 결론으로 건너뛰지 않습니다.
Suppose observed Y=X everywhere. In one assumed world, X is randomized and potential outcome Y(x)=x. In another, a common factor Z sets X=Z,Y=Z, while forcing X alone leaves Y=Z. Both worlds have the same observed line, but intervention effects are one and zero.
Regression is a function of the observational distribution. Precision in computing it cannot distinguish counterfactual structures with that same distribution. Schooling/wages, longevity/GDP and before/after FTE each need separately specified interventions and observation processes.
Observed association can still support description, measurement checks, assumption checks or prediction under a declared environment. Name that use accurately rather than silently upgrading it to a causal conclusion.
학부 연결 · 선택Undergraduate bridge · optional
39. 정확 분수와 모집단 불확실성은 다른 층위이다39. Exact arithmetic and population uncertainty are different layers
유한 보관 표의 OLS를 정확 분수로 계산하면 산술 반올림 오차를 줄일 수 있습니다. 그 표가 누구를 대표하는지, 다른 시점이나 다른 표본에서 계수가 어떻게 달라질지는 정확 분수만으로 알 수 없습니다. 같은 원행을 여러 번 복사해도 정보가 새로 생기지 않습니다.
다음 장들에서는 설명변수 행렬과 투영, 오차의 조건부 평균, 반복 표집, 큰 표본 근사, 이분산·의존성에 맞는 추론을 순서대로 추가합니다. 지금 ‘기울기 0이 아니다’라는 표 안의 계산과 ‘모집단 기울기 0을 기각한다’라는 검정 문장은 같지 않습니다.
실제 자료 실습은 p값이나 신뢰구간을 자동 생성하지 않습니다. 표적·표본선택·시간·단위·함수형 가정이 아직 정해지지 않았다면, 소수점을 늘리는 대신 무엇을 모르는지 먼저 적습니다. 특정 분야의 회귀 관행도 관측 단위를 무시하는 면허가 되지 않습니다.
Exact fractions reduce arithmetic rounding in a retained finite table. They do not reveal who the table represents or how a coefficient changes in another sample or period. Copying source rows creates no new information.
Later chapters add matrices, conditional-error assumptions, repeated sampling, asymptotics and inference for heteroskedastic or dependent data. A computed nonzero slope is different from rejecting a zero population slope.
The actual-data lab therefore does not automatically produce p-values or confidence intervals. If targets, selection, timing, units and functional assumptions remain unsettled, document the unknowns before adding decimal places. Familiar regression conventions do not remove observation-unit requirements.
기초Foundations
40. 실습 E · 변환하고 다시 복원한다40. Lab E · Transform and restore the fitted line
여섯 행에 X′=10+2X,Y′=3+5Y를 적용하세요. 변환된 최적 계수 b′=5,a′=−146/3, MSE′=275/9를 확인합니다. 각 행의 새 예측에서 3을 빼고 5로 나누면 원래 예측입니다. 원래와 변환된 손실의 비율은 25입니다.
다음에는 X 척도만 −1로 바꾸고 기울기 부호와 각 행 복원 예측을 비교합니다. 상수 X에서도 대표 계수 하나뿐 아니라 전체 해 가족이 대응하는지 읽습니다. 실제 단위 변환은 양의 척도로 시작하고 음수 선택은 축 방향 연습이라고 명시합니다.
Apply X′=10+2X,Y′=3+5Y to the six rows. Check b′=5,a′=−146/3 and MSE′=275/9. Subtracting three from each new prediction and dividing by five restores the original prediction; the loss ratio is 25.
Then use X scale −1 and compare slope orientation with restored predictions. For constant X, inspect correspondence of complete minimizing families, not only one representative. Start ordinary unit conversion with positive scales and label negative scales as coordinate reversals.
기초Foundations
41. 실제 국가 · 기대수명 지표와 1인당 실질 GDP41. Actual countries · longevity and real GDP per person
2026년 10월 20일 보관한 World Bank 원 API에서 2024년의 16개국 기대수명과 1인당 실질 GDP를 ISO·연도·지표 코드로 연결합니다. X는 출생 시 기대수명 SP.DYN.LE00.IN, Y는 2015년 불변 USD/명인 NY.GDP.PCAP.KD입니다. 각 국가는 한 행이고, 인구 가중 없이 국가마다 같은 작업 비중 1을 둡니다.
가용 16쌍의 기술적 OLS 기울기는 약 3,537.588, 절편은 약 −246,179.559입니다. 기대수명 지표는 해당 시점 사망률 패턴을 반영한 집단 지표이며 특정 개인 수명 예측이 아닙니다. 이 국가 간 기울기는 수명 연장 개입의 GDP 효과도, 개인 임금 효과도 아닙니다.
이 16행에서는 X 값이 각각 달라 관측 X별 평균이 Y 자체와 같아집니다. 유한 경험 법칙의 집단 내부 오차가 0이 되는 것은 사실이지만, 새 국가의 미지 조건부 평균을 완벽하게 배웠다는 뜻은 아닙니다. 국가 선택·시점·개정·집계 수준을 함께 기록합니다.
Join 2024 longevity and real GDP/person for 16 countries by ISO/year/indicator in the World Bank API retained on 20 October 2026. X is life expectancy at birth, SP.DYN.LE00.IN; Y is NY.GDP.PCAP.KD in constant-2015 USD/person. One country is one row with working weight one, not population weighting.
The available-pair descriptive slope is approximately 3,537.588 and intercept approximately −246,179.559. Period life expectancy is a population indicator based on mortality patterns, not a prediction of one person’s lifespan. This country association identifies neither an effect of longevity interventions on GDP nor an individual earnings effect.
Each X differs in these 16 rows, so empirical same-X means equal each observed Y. Zero within-group loss under that finite law does not mean the unknown conditional mean for a new country has been perfectly learned. Record country selection, date, revisions and aggregation level.
기초Foundations
42. 실제 사람 · 교육 연수와 원자료 절단 로그임금42. Actual people · schooling and source-trimmed log wages
Card 공개 복제 원자료의 3,613개 익명 남성 기록을 유지합니다. X는 기록된 교육 연수, Y는 codebook이 1976년 시간당 임금(센트)의 절단 로그라고 설명하는 원 lwage76입니다. Y는 3,010행에서 가용하며 603행은 미관측으로 유지합니다. 원시급이 가용하더라도 이 장의 결과를 임의로 log(raw wage)로 바꾸어 채우지 않습니다.
같은 3,010쌍의 OLS는 절편 약 5.570882, 기울기 약 0.052094입니다. 이는 교육 1년당 원 로그임금의 기술적 기울기입니다. 이를 약 5.2% 인과 수익률이라고 쓰지 않습니다. 실제 선택·누락·코호트와 교육 결정의 다른 요인을 관측만으로 제거한 것이 아닙니다.
원행 번호와 개인 코드는 구별합니다. 같은 교육 연수의 관측 평균도 이 가용 표의 평균이며, 미지 전체 모집단의 참 조건부 평균이라고 자동 선언하지 않습니다. 모든 중심화·공분산·잔차 계산은 동일한 가용 쌍을 사용합니다.
Retain all 3,613 anonymous male records in Card’s public replication source. X is recorded schooling; Y is source lwage76, described as the trimmed log of 1976 hourly wages in cents. Y is available in 3,010 records and unavailable in 603. Do not silently substitute log(raw wage) when that other variable happens to be available.
On the same 3,010 pairs, the descriptive intercept is approximately 5.570882 and slope approximately 0.052094. This is a source-log-wage association per schooling year, not an identified causal return of about 5.2%. Selection, unavailable outcomes, cohort restrictions and other schooling determinants remain relevant.
Keep source positions distinct from person codes. Observed means at the same schooling level describe this available table, not automatically the true full-population conditional expectation. Centering, covariance and residual calculations must use the same available pairs.
기초Foundations
43. 실제 점포 · 전후 FTE의 예측 관계43. Actual establishments · before/after FTE association
NJ/PA 원 public.dat의 410행은 점포 조사 기록입니다. 각 시점 FTE는 전일제+0.5×시간제+관리자로 만들되 세 구성값이 모두 가용할 때만 계산합니다. X는 전 시점 FTE, Y는 후 시점 FTE이며 384개 완전짝을 같은 원행 안에서 연결합니다. 가용 전 열과 후 열을 각각 따로 정렬하거나 같은 숫자 store 코드를 유일 키로 병합하지 않습니다.
코드 407은 원행 42와 168에 각각 나타납니다. 두 행의 체인·주·FTE가 다르므로 둘 다 보존합니다. 완전짝의 기술적 직선은 약 10.116555+0.515058X입니다. 이는 해당 표에서 이전 FTE와 이후 FTE를 요약한 회귀이지 정책이 FTE를 바꾼 크기나 새 점포에 대한 검증된 예측 성능이 아닙니다.
평균 변화는 약 −0.070443 FTE이지만 기울기에서 1을 뺀 값과 같지 않습니다. Y−X 회귀에서는 절편은 같고 기울기가 b−1이 되는 반면, 평균 변화는 a+(b−1)평균 X입니다. 단위·기울기·평균을 섞지 않습니다.
The 410 NJ/PA public.dat rows are establishment survey records. Construct each wave’s FTE as full-time +0.5×part-time +managers only when all components are available. X is before FTE and Y after FTE; 384 complete pairs are linked within original rows. Do not separately sort waves or merge on an assumed-unique numeric store code.
Code 407 occurs at original positions 42 and 168 with different chains, states and FTEs; preserve both. The available-pair descriptive line is approximately 10.116555+0.515058X. It is neither an identified policy effect nor validated performance on new establishments.
Mean change is approximately −0.070443 FTE, not simply slope minus one. Regressing Y−X on X keeps the intercept and changes the slope to b−1, whereas mean change is a+(b−1)mean X. Keep slopes, means and units distinct.
기초Foundations
44. 실습 F · 원행·가용 쌍·계수를 함께 확인한다44. Lab F · Inspect source rows, available pairs and coefficients
실제 국가·사람·점포 자료를 차례로 고릅니다. 원행 수 16/3,613/410과 가용 쌍 수 16/3,010/384를 확인하고, X와 Y의 기간·단위를 적으세요. 절편 포함 여부와 쿼리 X를 고른 뒤 계수·잔차·같은 X 집단의 의미를 읽습니다.
전체 표는 그대로 보존하고 계산에 쓰인 완전쌍을 표시합니다. 가중치 0과 결측은 다른 상태입니다. 실제 자료의 같음·다름을 읽는 도구이며, 버튼을 누르는 것이 무작위 배정·독립 표집·정책 식별을 추가하지는 않습니다. 가정한 여섯 행과 실제 기록을 같은 표제 아래 섞지 않습니다.
Select actual country, person and establishment sources. Check source counts 16/3,613/410 and complete-pair counts 16/3,010/384, then record X/Y periods and units. Choose the intercept and query X before interpreting coefficients, residuals and exact-X groups.
Preserve the full source table while marking available contributing pairs. Missing values and zero weights are distinct states. These controls inspect observations; they do not add random assignment, independent sampling or policy identification. Keep the assumed six-row law visibly distinct from actual records.
기초Foundations
45. Python과 R에서 같은 가용 쌍을 다시 계산한다45. Recalculate the same available pairs in Python and R
다운로드 코드의 첫 검사는 분모입니다. 원 API·ZIP이 있으면 원 필드에서 다시 읽고, 없으면 제공한 최소 공개 선택 CSV를 썼음을 기록합니다. Python의 정확 분수와 R의 독립 중심화 계산을 비교하며, 이미 계산된 사례 JSON의 계수를 정답 입력으로 복사하지 않습니다.
표본 OLS를 R의 lm으로 확인할 때 formula와 data를 명시하고 어떤 행을 제외했는지 직접 보관합니다. 수식에 변환을 넣었다면 변수 단위와 원시급/절단 로그의 구별도 기록합니다. 두 프로그램의 소수가 가까운 것과 추정 대상·가정이 타당한 것은 별개의 검사입니다.
Check denominators first. With retained API/ZIP originals, reread source fields; without them, disclose the supplied public selection CSVs. Compare exact Python fractions with independent R centered calculations rather than copying coefficients from the computed case JSON.
When checking sample OLS with R lm, state formula and data explicitly and retain the excluded-row record. Document transformations, units and the distinction between raw wages and source-trimmed logs. Numerical agreement and the validity of targets/assumptions are separate checks.
자료 묶음을 풀고 코드와 실제데이터 폴더를 함께 두세요. 터미널에서 코드 파일이 있는 폴더로 이동해 아래 명령을 실행합니다. 코딩이 처음이라면 손계산과 웹 실습을 먼저 하고, 데이터 사이언스 입문에서 코드를 배운 뒤 돌아와도 됩니다.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.
결과 파일은 각 코드에 지정된 결과 폴더에 저장됩니다. CSV 원자료는 덮어쓰지 않습니다.Result files are saved in the result directory specified by each script; the input CSVs are not overwritten.
기초Foundations
46. 짧은 회귀 보고서를 스스로 완성한다46. Write a short regression report independently
실제 세 자료 중 하나를 골라 첫 문단에 관측 단위·기간·X·Y·전체와 가용 분모·가중치를 씁니다. 둘째 문단에는 직선의 목적과 함수 집합, 절편 여부, 계수 단위, 관측 X 범위를 적습니다. 셋째에는 한 원행의 예측과 잔차를 손계산해 코드와 대조합니다.
마지막에는 ‘직교가 보장하는 것 두 가지’와 ‘보장하지 않는 것 두 가지’를 문장으로 씁니다. 상수 X, 결측 행 하나 추가, 단위 변환 가운데 하나를 수행하고 어떤 결과가 유지되는지 증명합니다. 인과나 모집단 추론을 원하면 현재 보고서에 없는 추가 설계·확률 조건을 명시합니다.
Choose one actual source. State observation units, periods, X/Y, source/available counts and weights. Then give the line’s purpose, function class, intercept choice, coefficient units and observed X support. Hand-check one source row’s prediction and residual against code.
Finish with two statements orthogonality guarantees and two it does not. Analyze one constant-X, missing-row or unit-change modification and prove the invariants. A causal or population-inference goal requires additional design and probability conditions absent from the descriptive report.
기초Foundations
47. 공식 원자료를 직선·조건부 평균과 연결한다47. Connect official source records to lines and conditional means
국가 · 수명 지표와 생산 집계를 한 직선으로 읽을 때
2026년 10월 20일 내려받아 보관한 World Bank 원 다중 지표 API를 이번 장에서 다시 읽었습니다. 2024년의 국가 ISO·연도·지표 코드로 NY.GDP.PCAP.KD와 SP.DYN.LE00.IN을 연결하며 각 지표의 원 배열 위치도 남깁니다. 관측 연도 2024, 원 다운로드일 2026년 10월 20일, 이번 검토일 2026년 10월 27일은 서로 다른 날짜입니다. 새 최신 조회를 했다는 뜻이 아닙니다.
관측 단위는 선택된 국가×연도 16개이고 사람 16명이 아닙니다. X는 출생 시 기대수명 지표의 년, Y는 2015년 불변 USD/명의 1인당 실질 GDP입니다. 개인 임금·명목 달러·PPP 달러와 다릅니다. 기간 기대수명은 해당 시점의 사망률 패턴으로 구성한 집단 지표이며 특정 개인의 수명을 예측한 값이 아닙니다. 각 국가의 작업 가중치를 1로 두어 국가 균등 기술적 투영을 정의합니다.
실제 2024년 기록 · 반올림 표시
ISO
GDP 원행
수명 원행
X · 년
Y · 2015 USD/명
AUS
2161
2881
83.051
61,486.38
BRA
2206
2926
76.023
9,566.75
CAN
2251
2971
82.108
45,061.39
CHN
2296
3016
78.017
13,119.11
DEU
2341
3061
80.793
44,027.76
FRA
2386
3106
82.980
39,683.40
GBR
2431
3151
81.387
47,900.97
IDN
2476
3196
71.288
4,367.95
IND
2521
3241
72.235
2,366.83
JPN
2566
3286
84.036
37,976.64
KOR
2611
3331
83.629
37,048.43
MEX
2656
3376
75.264
10,284.03
SGP
2701
3421
83.346
68,129.70
USA
2746
3466
78.890
66,856.51
VNM
2791
3511
74.736
4,012.51
ZAF
2836
3556
66.312
5,715.48
실제 가용 쌍 · 절편 포함 무가중 OLS · 소수는 반올림
양
값
원행 / 완전쌍
16 / 16
평균 X
78.381030
평균 Y
31,100.238572
절편 a
-246,179.558875
기울기 b
3,537.588058
MSE
204,617,871.119455
중심 R²
0.615395
각 축의 실제 점은 연결하지 않습니다. 기술적 적합선은 같은 16개 가용 쌍에서 계산한 a+bX입니다. 기울기 약 3,537.588의 단위는 기대수명 지표 1년당 2015 USD/명이며, 수명을 1년 늘리는 보건 개입의 GDP 효과가 아닙니다. 절편 약 −246,179.559는 X=0에서의 직선 연장값이지 현실 국가의 생산 예측이 아닙니다.
기대수명을 80년 중심으로 옮겨 X′=X−80으로 쓰면 기울기는 같고 절편은 a+80b로 바뀝니다. GDP를 천 USD 단위로 바꾸면 절편과 기울기는 1/1000, MSE는 1/1,000,000이 됩니다. 물리적 기록이나 관측 국가 간 관계가 바뀐 것이 아니라 좌표 표현이 바뀐 것입니다.
16개 X가 모두 달라 경험 법칙의 같은-X 집단에는 한 국가씩만 들어 있습니다. 그 집단 평균을 그대로 예측하면 내부 위험이 0입니다. 하지만 새 국가·미래 시점의 미지 조건부 평균이 학습되었다는 뜻은 아닙니다. 국가 선택, 집계·개정, 공통 충격과 반대 방향의 설명 가능성이 남습니다. 유한 표의 정확 직교와 모집단·인과 가정을 구분합니다.
3,537.588을 수명 1년의 인과효과라고 써도 되나요?
아닙니다. 국가 균등 작업 법칙에서의 연관 기울기입니다. 어떤 개입이 언제 누구의 결과를 바꾸는지 정의하고 그 반사실을 관측 대비에 연결하는 별도 식별 근거가 필요합니다.
같은-X 평균의 위험 0이면 왜 직선을 쓰나요?
한 행마다 평균을 복사하면 표 안에서는 맞지만 미지 함수·새 지점 예측을 배운 것은 아닙니다. 직선은 명시한 낮은 차원의 요약이며, 함수 제약의 손실과 표본 밖 검증을 별도로 평가해야 합니다.
David Card의 공개 proximity.zip 안 nls.dat와 code_bk.txt를 직접 읽습니다. 원 익명 남성 3,613행의 위치와 원 개인 코드를 따로 보존합니다. X는 기록된 교육 연수이며 Y는 원 codebook이 1976년 시간당 임금(센트)의 절단 로그로 설명하는 lwage76입니다. 원시급을 로그로 새로 계산한 결과와 임의로 바꾸지 않습니다. 원시급 가용 수와 이 절단 로그의 가용 수가 같다는 보장도 없습니다.
교육과 지정 결과가 모두 가용한 쌍은 3,010개이고 603개 Y는 미관측으로 남깁니다. 같은 3,010쌍에서 평균·중심 곱·기울기·잔차를 계산합니다. 전체 교육 평균과 다른 Y 가용 평균을 섞는 방식은 같은 목적함수의 OLS가 아닙니다. 모든 작업 가중치는 1이며 표집 대표성을 새로 부여한 것은 아닙니다.
실제 원파일 앞 8행 · 전체 파일은 다운로드에 보존
원행
개인 코드
X · 교육 년
Y · 원 로그
1
2
7
6.30627529
2
3
12
6.17586727
3
4
12
6.58063914
4
5
11
5.52146092
5
6
12
6.59167373
6
7
12
6.21460810
7
8
18
6.33682573
8
9
14
6.41017488
실제 가용 쌍 · 절편 포함 무가중 OLS · 소수는 반올림
양
값
원행 / 완전쌍
3613 / 3010
평균 X
13.263455
평균 Y
6.261832
절편 a
5.570882
기울기 b
0.052094
MSE
0.177451
중심 R²
0.098737
단순 OLS 기울기는 약 0.052094, 절편은 약 5.570882입니다. 기울기의 단위는 교육 1년당 원 로그임금 척도입니다. exp(b)−1을 계산하는 것은 선택한 로그 직선의 수학적 변환이지, 교육을 1년 늘리면 임금이 그 비율만큼 오른다는 인과효과의 증명이 아닙니다. 관측 교육 선택·다른 특성·원 결과 절단과 가용성은 별도 문제입니다.
같은 교육 연수의 경험 평균을 계산해 직선과 비교할 수 있습니다. 선형 투영의 두 직교 조건은 Σe=0,ΣXe=0이며 모든 교육 집단의 잔차 평균이 0일 필요는 없습니다. 집단 빈도가 다르면 전체 직선은 그 빈도로 가중된 근사입니다. 교육 집단을 같은 비중으로 바꾸는 새 분석은 다른 표적이므로 별도 표시해야 합니다.
로그 결과를 센트/시간에서 달러/시간의 로그로 바꾸는 순수 단위 표현은 Y′=Y−ln(100)입니다. 절편은 ln(100)만큼 내려가고 기울기와 잔차는 같습니다. 이 단위 논의가 원시급 로그를 원 절단 결과에 대입하라는 뜻은 아닙니다. exp(평균 로그)는 기하 중심이며 평균 수준 임금과도 일반적으로 다릅니다.
b≈0.052094이면 교육의 약 5.2% 수익률인가요?
기술적 로그 기울기만으로는 인과 수익률을 식별하지 못합니다. 개입·표적·선택과 교란·원 결과 정의를 설명하는 추가 근거가 필요합니다.
모든 교육 집단의 잔차 평균이 0인가요?
아닙니다. 절편 포함 OLS는 전체 잔차 합과 X 곱 잔차 합을 0으로 만듭니다. 조건부 평균이 직선과 일치하지 않으면 개별 집단의 평균 잔차는 남습니다. 공개 같은-X 요약표로 직접 확인할 수 있습니다.
603개의 미관측 로그를 0으로 채우면 같은 분석인가요?
아닙니다. 새로운 값을 만들어 가용 법칙·평균·기울기를 바꿉니다. 결측 처리의 정당성이나 원 모집단 추론은 계산만으로 해결되지 않습니다.
Card–Krueger 공개 njmin.zip의 public.dat는 1992년 두 조사 시점을 같은 원행에 담습니다. 단위는 개별 점포 조사 기록이며 법인 전체의 고용이 아닙니다. 원 확인 SAS의 FTE=전일제+0.5×시간제+관리자를 적용하되 세 구성값이 모두 있을 때만 그 시점 값을 계산합니다. 같은 원행의 전후를 쌍으로 연결해 X=전 FTE,Y=후 FTE를 만듭니다.
410원행 중 384쌍이 완전하고 26행은 전후 중 하나 이상이 미관측입니다. 서로 다른 가용 전 열과 후 열을 따로 정렬해 빼거나 원 store 코드를 무조건 고유 키로 병합하지 않습니다. 407은 원행 42의 PA·체인2와 원행 168의 NJ·체인4에 각각 나타나므로 모두 유지합니다. 위치 키는 이 파일 기록을 추적하는 장치이며 독립성이나 영구 개체 식별의 증거가 아닙니다.
FTEt=FTt+0.5PTt+Managerst
실제 가용 쌍 · 절편 포함 무가중 OLS · 소수는 반올림
양
값
원행 / 완전쌍
410 / 384
평균 X
21.006641
평균 Y
20.936198
절편 a
10.116555
기울기 b
0.515058
MSE
58.321802
중심 R²
0.306675
실제 중복 코드 · 서로 다른 원행
원행
코드
주
전 FTE
후 FTE
변화
42
407
PA
11.00
11.00
0.00
168
407
NJ
12.00
14.50
2.50
기술적 적합선은 약 10.116555+0.515058X입니다. 전 FTE가 더 큰 점포가 후 FTE도 더 큰 경향을 한 직선으로 요약합니다. 평균 전 FTE는 21.006640625, 평균 후 FTE는 약 20.936198이고 평균 변화는 정확히 −541/7680 FTE입니다. 이는 기울기−1과 다릅니다. 변화 Z=Y−X의 회귀식은 같은 절편과 기울기 b−1을 갖고 잔차는 그대로입니다.
실제 점과 적합선은 선택된 가용 표의 기술 요약입니다. 정책이 없었을 때 같은 점포의 후 FTE를 관측한 것이 아니므로 이 기울기를 최저임금 정책 효과라고 쓰지 않습니다. 또 훈련 표 안의 MSE는 미래 점포나 새 조사에 대한 검증 오차가 아닙니다. 시간·공통 체인·주별 충격과 가용성에 맞춘 별도 설계가 필요합니다.
왜 평균 변화가 b−1이 아닌가요?
절편 포함 평균점 조건에 의해 평균 Y=a+b평균 X입니다. 따라서 평균(Y−X)=a+(b−1)평균 X입니다. b−1은 변화 회귀의 기울기이며 평균과 단위·역할이 다릅니다.
표 안의 잔차 직교로 정책 외생성을 확인하나요?
아닙니다. 지정한 가용 쌍의 제곱손실 최적화 항등식입니다. 정책 없는 경로·동시 충격·측정과 선택을 식별하는 추가 근거를 대신하지 않습니다.
Countries · a line between longevity and production aggregates
We reread the retained multi-indicator World Bank API originally downloaded on 20 October 2026. Join NY.GDP.PCAP.KD and SP.DYN.LE00.IN for 2024 by country ISO, year and indicator while retaining both original array positions. Observation year 2024, original download date 20 October 2026 and this review date 27 October 2026 are distinct. This is reuse of archived bytes, not a claim of a newly collected current vintage.
The units are sixteen selected country-year records, not sixteen people. X is period life expectancy at birth in years; Y is real GDP/person in constant-2015 USD, distinct from personal earnings, nominal dollars or PPP dollars. Period life expectancy is a population indicator under that period’s mortality pattern, not an individual lifespan prediction. Working weight one per country defines an equal-country descriptive projection.
Actual 2024 records · rounded displays
ISO
GDP source row
Life source row
X · years
Y · 2015 USD/person
AUS
2161
2881
83.051
61,486.38
BRA
2206
2926
76.023
9,566.75
CAN
2251
2971
82.108
45,061.39
CHN
2296
3016
78.017
13,119.11
DEU
2341
3061
80.793
44,027.76
FRA
2386
3106
82.980
39,683.40
GBR
2431
3151
81.387
47,900.97
IDN
2476
3196
71.288
4,367.95
IND
2521
3241
72.235
2,366.83
JPN
2566
3286
84.036
37,976.64
KOR
2611
3331
83.629
37,048.43
MEX
2656
3376
75.264
10,284.03
SGP
2701
3421
83.346
68,129.70
USA
2746
3466
78.890
66,856.51
VNM
2791
3511
74.736
4,012.51
ZAF
2836
3556
66.312
5,715.48
Actual available pairs · intercept OLS with working weights one · rounded decimals
Quantity
Value
Source / complete pairs
16 / 16
Mean X
78.381030
Mean Y
31,100.238572
Intercept a
-246,179.558875
Slope b
3,537.588058
MSE
204,617,871.119455
Centered R²
0.615395
Actual scatter points are not connected. The fitted line is a+bX from the same sixteen pairs. Slope approximately 3,537.588 has units of constant-2015 USD/person per year of the longevity indicator, not an identified GDP effect of a health intervention. Intercept approximately −246,179.559 is a line extension at X=0, not a realistic country production prediction.
Centering X′=X−80 preserves the slope and changes the intercept to a+80b. Expressing GDP in thousands of USD divides coefficients by 1000 and MSE by 1,000,000. These are coordinate changes, not altered observations or country relationships.
All sixteen X values differ, so empirical exact-X groups contain one country each. Predicting each group mean gives zero within-group risk under that finite law, not perfect learning of a new country’s unknown conditional expectation. Selection, aggregation, revisions, common shocks and alternative explanations remain. Exact finite-table orthogonality is distinct from population or causal assumptions.
Can 3,537.588 be called a causal effect of one extra life year?
No. It is an association slope under an equal-country working law. Define an intervention and outcome timing and justify the link between its counterfactual and the observed comparison.
Why use a line if empirical same-X risk is zero?
Copying a singleton group fits the known table without learning an unknown function or new-point performance. A line is a declared low-dimensional summary; evaluate its approximation cost and external prediction separately.
Download · actual selections and exact calculations
Read nls.dat and code_bk.txt inside Card’s public proximity.zip. Preserve all 3,613 anonymous male source positions separately from original person codes. X is recorded schooling; Y is source lwage76, described as the trimmed log of 1976 hourly wages in cents. Do not substitute newly logged raw wages. Availability of raw wages and this trimmed source measure need not coincide.
There are 3,010 available schooling/outcome pairs and 603 unavailable Y values. Compute means, centered products, slopes and residuals on the same pairs; mixing an all-schooling mean with another outcome subset does not implement the same OLS objective. Working weights one do not establish survey representation.
Actual first eight source records · full file retained in download
Source row
Person code
X · schooling years
Y · source log
1
2
7
6.30627529
2
3
12
6.17586727
3
4
12
6.58063914
4
5
11
5.52146092
5
6
12
6.59167373
6
7
12
6.21460810
7
8
18
6.33682573
8
9
14
6.41017488
Actual available pairs · intercept OLS with working weights one · rounded decimals
Quantity
Value
Source / complete pairs
3613 / 3010
Mean X
13.263455
Mean Y
6.261832
Intercept a
5.570882
Slope b
0.052094
MSE
0.177451
Centered R²
0.098737
The simple slope is approximately 0.052094 and intercept approximately 5.570882. Slope units are source-log-wage units per schooling year. Computing exp(b)−1 transforms the selected log line mathematically; it does not prove an effect of assigning an extra schooling year. Schooling selection, other characteristics, trimming and outcome availability remain separate issues.
Compare empirical means at each schooling level with the line. The two projection moments Σe=0 and ΣXe=0 do not force a zero residual mean in every schooling group. Group frequencies weight the overall approximation. Equal-schooling-group weighting would define a different target and must be labelled separately.
A pure log-unit conversion from cents/hour to dollars/hour is Y′=Y−ln(100), shifting the intercept down while preserving slope and residuals. This is not permission to replace the source-trimmed measure with logged raw wages. Exp(mean log) is a geometric center, generally different from mean wage levels.
Does b≈0.052094 establish a roughly 5.2% schooling return?
A descriptive log slope does not identify a causal return. Additional evidence must connect intervention, target, selection/confounding and the source outcome definition.
Must every schooling-group residual mean vanish?
No. Intercept OLS zeroes two overall residual moments. If the conditional mean differs from the line, group residual means remain. Inspect the downloadable exact-X summaries directly.
Is zero-filling 603 unavailable logs the same analysis?
No. Invented zeros change the available law, means and slopes. Arithmetic alone does not justify missing-data handling or population inference.
Download · actual selections and exact calculations
Establishment practice · descriptive before/after size projection
Card–Krueger’s public njmin.zip places two 1992 survey waves in the same public.dat source record. Units are establishment survey records, not corporate employment totals. Apply the source SAS definition FTE=full-time +0.5×part-time +managers only when all three components are available. Pair X=before FTE and Y=after FTE within original rows.
Of 410 source rows, 384 are complete pairs and 26 lack at least one wave. Do not separately sort available wave columns or assume every numeric store code is unique. Code 407 occurs in PA/chain2/source row 42 and NJ/chain4/source row 168; retain both. Positions trace retained records without certifying independence or permanent entity identity.
FTEt=FTt+0.5PTt+Managerst
Actual available pairs · intercept OLS with working weights one · rounded decimals
Quantity
Value
Source / complete pairs
410 / 384
Mean X
21.006641
Mean Y
20.936198
Intercept a
10.116555
Slope b
0.515058
MSE
58.321802
Centered R²
0.306675
Actual repeated code · distinct original records
Source row
Code
State
Before FTE
After FTE
Change
42
407
PA
11.00
11.00
0.00
168
407
NJ
12.00
14.50
2.50
The descriptive line is approximately 10.116555+0.515058X, summarizing the association between establishment sizes across waves. Mean before FTE is 21.006640625, mean after approximately 20.936198, and mean change exactly −541/7680 FTE. It is not slope minus one. Regressing Z=Y−X on X preserves the intercept and residuals and changes the slope to b−1.
Actual points and the fitted line summarize the selected available table. No-policy later outcomes for the same establishments are unobserved, so this slope is not a minimum-wage policy effect. In-table MSE is also not validated future/new-establishment error. Timing, shared chain/state shocks and availability need separate design consideration.
Why is mean change not b−1?
The intercept mean-point condition gives mean Y=a+b mean X, hence mean(Y−X)=a+(b−1)mean X. Slope b−1 describes change per unit of baseline X rather than the overall mean change.
Does in-table residual orthogonality verify policy exogeneity?
No. It is an optimization identity on the specified available pairs, not evidence replacing no-policy paths, concurrent-shock, measurement or selection assumptions.
Download · actual selections and exact calculations
48. 공식 영상·원문·학자 소개로 다시 읽는다48. Return through official video, texts and a historical scholar
MIT 6.036 공식 회귀 영상을 본문에서 재생하며, 제곱오차를 최소화하는 선과 인과적 구조식을 구별해 메모합니다. Introduction to Econometrics with R 4.2의 핵심개념 4.2에서는 절편·기울기·예측·잔차의 식을 이 장의 여섯 행에 직접 적용합니다. 외부 사례의 숫자를 옮기는 대신 같은 연산을 새 작은 표로 재현합니다.
Legendre의 1805년 혜성 궤도 관련 작업과 관측 불일치를 다루는 최소제곱의 맥락은 St Andrews가 제공하는 1834년 게재 RAS 추도문에서 읽습니다. 현대 회귀의 인과 식별을 그 역사만으로 정당화하지 않습니다. 심화 읽기는 Chernozhukov·Fernández-Val의 MIT 14.382 2017 강의노트 1의 인쇄 2쪽 ‘Least Squares’로 제한하여 유한 이차 모멘트·직교·완전 랭크 조건을 확인합니다.
Watch the official MIT 6.036 regression video in the chapter and distinguish a squared-error minimizing line from a causal structural equation. Apply the intercept, slope, prediction and residual formulas in IEWR 4.2, Key Concept 4.2, to our six rows rather than importing its historical case numbers.
Read the RAS obituary published in 1834 hosted by St Andrews for Legendre’s 1805 comet-orbit work and the handling of discordant observations. That history does not establish modern causal identification. For a second pass, use only printed page 2, “Least Squares,” of Chernozhukov and Fernández-Val’s MIT 14.382 2017 Lecture 1 notes to inspect finite second moments, orthogonality and full-rank conditions.
본문의 질문을 넓히는 선택 학습입니다. 영상을 보기 전 질문을 먼저 읽고, 자신의 답을 쓴 뒤 해설과 비교하세요. 자료의 언어·선수 지식은 각 항목에 표시했습니다.Optional extensions to the chapter. Read the question first, write your answer, then compare with the explanation. Language and prerequisites are indicated below.
회귀 입문 · 어떤 선을 최선이라고 부를까?Introduction to regression · which line is best?
MIT Open Learning Library · 6.036 · 2019
공식 회귀 입문에서 예측 함수와 제곱오차의 역할을 찾으세요. 영상과 본문의 직선을 인과 구조식으로 자동 바꾸지 않습니다. 본문에서 재생하며 작은 여섯 행의 목적함수를 옆에 적습니다.Identify the prediction function and squared-error objective in the official regression introduction. Do not automatically reinterpret the line as a causal equation. Watch in the chapter and write the six-row objective beside it.
교재 안의 YouTube 플레이어에서 재생합니다. 원영상에서 제공하는 자막은 플레이어의 CC·설정에서 선택할 수 있습니다.Playback stays in this chapter’s YouTube player. Available captions can be selected through CC/settings.
보고 읽은 뒤 답하기Respond after watching/reading가장 잘 맞는 직선이면 모든 같은-X 평균을 통과하나요?Must the best line pass through every same-X mean?
생각을 점검하는 해설Check your reasoning
아닙니다. 이 장의 가정 평균 0,1,4는 직선이 아니며 최선 직선 −1/3+2X와 다릅니다. 전체 직교와 각 집단의 평균 잔차 0은 다른 조건입니다.No. Assumed group means 0,1,4 are nonlinear and differ from the best line −1/3+2X. Overall orthogonality and zero residual mean in every group are different conditions.
Adrien-Marie Legendre · 관측의 불일치와 최소제곱Adrien-Marie Legendre · discordant observations and least squares
Royal Astronomical Society · obituary published in 1834 · St Andrews archive
원 추도문에서 1805년 혜성 궤도 작업과 관측 오차를 함께 다루는 최소제곱의 맥락을 읽습니다. 인물의 권위나 역사적 성과가 현대 회귀의 인과 가정을 대신 증명하지는 않습니다.Read the obituary’s account of the 1805 comet-orbit work and handling discordant observations. Historical achievement does not establish the causal assumptions of a modern regression.
보고 읽은 뒤 답하기Respond after watching/reading관측 오차를 합리적으로 줄이면 인과효과도 알아낼까요?Does reducing observational fitting error identify causality?
생각을 점검하는 해설Check your reasoning
제곱손실을 최소화하는 함수와 관측되지 않은 개입 결과를 연결하는 식별은 별개입니다. 같은 관측 직선에 다른 개입 효과가 양립할 수 있습니다.Squared-loss optimization differs from identifying unobserved intervention outcomes. The same observed line can coexist with different intervention effects.
단순 OLS 식을 여섯 행에 적용하기Apply the simple OLS formulas to six rows
Introduction to Econometrics with R · 4.2 · Key Concept 4.2
핵심개념 4.2의 절편·기울기·예측·잔차 정의와 최소제곱 목적을 읽습니다. 이 장의 가정 표로 다시 계산하며 외부 사례 숫자를 현재 자료의 결과로 옮기지 않습니다.Read Key Concept 4.2’s intercept, slope, fitted-value and residual definitions and the least-squares objective. Recalculate our assumed table rather than importing its case numbers as current-source results.
보고 읽은 뒤 답하기Respond after watching/reading기울기 식의 분모가 0이면 0을 넣으면 되나요?Can a zero denominator in the slope formula be replaced by zero?
생각을 점검하는 해설Check your reasoning
아닙니다. 절편 포함 상수 X에서는 a=평균 Y−bX라는 전체 해 가족을 계산해야 합니다. 대표 기울기 0은 하나의 선택이며 유일한 식별값이 아닙니다.No. With constant X and an intercept, retain the whole family a=mean Y−bX. Representative slope zero is one choice, not a uniquely identified coefficient.
심화 · 선형 투영의 모멘트와 랭크 조건Second pass · projection moments and rank conditions
MIT 14.382 · Chernozhukov and Fernández-Val · 2017 Lecture 1
인쇄 2쪽의 2절 Least Squares만 지정해서 읽습니다. 유한 이차 모멘트, 모집단·표본 투영, 직교와 완전 랭크 조건을 확인하고 뒤 행렬 장의 일반화로 연결합니다.Read only printed page 2, section 2, Least Squares. Inspect finite second moments, population/sample projection, orthogonality and full-rank conditions, then connect to the later matrix chapter.
보고 읽은 뒤 답하기Respond after watching/reading분해 Y=Xᵀβ+ε를 얻으려면 참 조건부 평균이 반드시 선형인가요?Must the true conditional mean be linear to obtain a projection decomposition Y=Xᵀβ+ε?
생각을 점검하는 해설Check your reasoning
아닙니다. 제곱적분 가능한 변수의 선택 선형 함수집합에 대한 최적화가 그 직교 분해를 만듭니다. ε의 조건부 평균 0이나 구조적 인과 의미는 그보다 강한 별도 조건입니다.No. Optimization over a selected linear function class yields the orthogonal decomposition with suitable finite moments. Zero conditional mean or a structural causal meaning for ε are additional stronger conditions.
연습문제 · 계산에서 설명과 증명까지Exercises: calculation, explanation and proof
먼저 혼자 풀고 풀이를 여세요. 숫자와 함께 단위·포함 기준·계산 이유를 확인하세요.Attempt each problem before opening its solution. Check units, inclusion rules and the reason for the calculation.
1. 전체 평균과 집단 평균Overall and group means
가정한 여섯 행은 (X,Y)=(0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)이고 각 행의 비중은 1/6입니다. 전체 Y 평균과 X=0,1,2의 평균을 계산하세요.
Assume six equally weighted rows (X,Y)=(0,−1),(0,1),(1,0),(1,2),(2,3),(2,5). Calculate mean Y overall and within X=0,1,2.
풀이와 확인할 이유Solution and explanation
전체 합은 10이므로 평균은 10/6=5/3입니다. 각 집단은 두 행이므로 평균은 (−1+1)/2=0, (0+2)/2=1, (3+5)/2=4입니다. X를 알고 계산한 평균과 X를 무시한 평균은 다른 예측 규칙입니다.
The total is 10, so overall mean Y=5/3. The two-row group means are 0,1,4. A mean conditional on known X is a different prediction rule from one overall mean.
2. 조건부 분산의 분모Conditional variance denominator
완전히 알려진 가정 법칙에서 X=1일 때 Y=0과 2가 각각 확률 1/2입니다. 조건부 평균·분산과 예측값 1의 조건부 제곱위험을 구하세요.
Under a fully specified assumed law, conditional on X=1, Y is 0 or 2 with probability 1/2 each. Find its mean, variance and squared risk of prediction 1.
풀이와 확인할 이유Solution and explanation
평균은 1입니다. 분산은 ((0−1)²+(2−1)²)/2=1이고 같은 식이 예측 1의 위험입니다. 이는 알려진 유한 법칙의 분산이므로 분모를 표본 불편분산의 n−1로 바꾸지 않습니다.
The mean is 1 and variance is ((0−1)²+(2−1)²)/2=1, also the risk of predicting 1. This is a known finite-law variance, not an unbiased sample-variance estimator with denominator n−1.
3. 집단 안에서 다른 예측Another prediction within a group
가정 법칙에서 X=2이면 Y=3,5가 같은 확률입니다. 예측 c=3과 c=4의 제곱위험을 비교하고 최소값을 설명하세요.
Under an assumed law, Y=3,5 are equally likely given X=2. Compare squared risks at c=3 and c=4 and explain the minimum.
풀이와 확인할 이유Solution and explanation
c=3의 위험은 (0²+2²)/2=2, c=4는 ((−1)²+1²)/2=1입니다. 일반 c의 위험은 1+(c−4)²이므로 유일한 최소 예측은 4입니다. 관측 두 값 가운데 하나를 골라야 할 필요는 없습니다.
Risks are 2 at c=3 and 1 at c=4. Generally risk=1+(c−4)², so the unique minimizing prediction is 4, which need not be one of the observed outcomes.
4. 모든 함수와 직선의 선택 집합All functions versus straight lines
X=0,1,2가 각각 확률 1/3이고 조건부 평균은 0,1,4, 각 조건부 분산은 1인 가정 법칙입니다. 아무 함수나 고를 때의 최저 제곱위험과 직선으로 제한했을 때 그 값이 더 낮아질 수 있는지 설명하세요.
Assume X=0,1,2 each have probability 1/3, conditional means 0,1,4 and conditional variance 1 in each group. Find the minimum risk over all functions and whether a line can have lower risk.
풀이와 확인할 이유Solution and explanation
각 X에서 조건부 평균을 예측하면 위험은 내부 분산의 평균 1입니다. 어떤 예측 함수도 1+E[(m(X)−g(X))²]보다 낮아질 수 없으므로 직선도 1보다 작을 수 없습니다. 세 평균은 한 직선에 놓이지 않아 이 법칙의 최선 직선 위험은 엄격히 더 큽니다.
Predicting each conditional mean gives risk 1. Every function has risk 1+E[(m(X)−g(X))²], so a line cannot improve on one. Because the three means are not collinear, the best line has strictly larger risk.
5. 한 값이 결측일 때One unavailable outcome
가정 원행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,결측)을 모두 보관하고 가용 쌍을 균등하게 계산합니다. 가용 Y 평균과 X=2의 가용 평균은 무엇이며 미관측 값을 0으로 넣어도 되나요?
Retain assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,missing) and weight available pairs equally. Find available mean Y and the available X=2 mean. May the missing value be replaced by zero?
풀이와 확인할 이유Solution and explanation
가용 분모는 5, 합은 5이므로 평균은 1입니다. X=2에서는 가용 한 행의 값 3이 평균입니다. 미관측을 0으로 채우면 분모와 집단 법칙을 임의로 바꾸므로 같은 계산이 아닙니다. 원행 수 6과 가용 쌍 수 5를 함께 적습니다.
Five available outcomes sum to five, giving mean one. The single available X=2 value gives group mean three. Zero-filling invents an outcome and changes denominators and the law. Report six source rows and five available pairs separately.
6. 집단 비중 변경Changing group masses
가정 X=0,1,2의 조건부 평균은 0,1,4입니다. 원 집단 비중은 각각 1/3이고 새 비중은 1/2, 1/4, 1/4입니다. 두 전체 평균과 조건부 평균의 변화를 계산하세요.
Assumed conditional means at X=0,1,2 are 0,1,4. Compare overall means under masses (1/3,1/3,1/3) and (1/2, 1/4, 1/4), and state what happens to the conditional means.
풀이와 확인할 이유Solution and explanation
원 평균은 (0+1+4)/3=5/3, 새 평균은 0/2+1/4+4/4=5/4입니다. 조건부 평균은 그대로이며 X가 나타나는 비중만 바뀌었습니다. 전체 기대값은 조건부 평균과 X 분포 둘 다에 의존합니다.
The original mean is 5/3 and the new mean is 5/4. Conditional means stay fixed; only the X distribution changes. Overall expectation depends on both components.
7. 조건부 평균 근사 위험Conditional-mean approximation risk
가정 X=0,1,2가 균등하고 조건부 평균은 0,1,4, 내부 분산은 각각 1입니다. 함수 g(0)=0,g(1)=1,g(2)=3의 총 제곱위험을 구하세요.
Assume equally likely X=0,1,2, conditional means 0,1,4 and conditional variances one. Find total squared risk for g(0)=0,g(1)=1,g(2)=3.
풀이와 확인할 이유Solution and explanation
집단 평균 근사 오차는 (0²+0²+1²)/3=1/3입니다. 내부 위험 1을 더하면 총 위험은 4/3입니다. 관측 Y와 g의 차이를 직접 제곱해도 같은 값이 나오며 내부 위험을 두 번 더하지 않습니다.
Mean approximation error is (0+0+1)/3=1/3. Adding within-group risk one gives total risk 4/3. Directly averaging squared Y−g errors gives the same result, without counting within risk twice.
8. 연속 조건의 확률 0Conditioning on a zero-probability point
가정 X는 [0,1] 균등 연속변수이고 Y=X²입니다. P(X=1/2)=0인데 E[Y|X=1/2]를 단순 확률비 0/0으로 정의하면 왜 안 되나요? 자연스러운 조건부 평균 버전을 쓰세요.
Assume X is uniform on [0,1] and Y=X². Since P(X=1/2)=0, why is a naive probability-ratio definition unsuitable? Give a natural conditional-mean version.
풀이와 확인할 이유Solution and explanation
단일점의 확률이 0이므로 이산 사건용 분모로 나눌 수 없습니다. Y가 X의 함수이므로 m(x)=x²는 조건부 평균의 자연스러운 버전이며 x=1/2에서 1/4입니다. 조건부 기대값은 거의 확실한 동치로 정의되므로 확률 0인 점의 버전 선택과 관측에서의 식별은 구별합니다.
An individual point has zero probability, so the discrete-event division is unavailable. Since Y is a function of X, m(x)=x² is a natural version, giving 1/4 at x=1/2. Conditional expectations are defined up to almost-sure equivalence; version choice at a null point and observational identification are distinct.
9. 영가중치 행A zero-weight row
가정 행 (X,Y,w)=(0,0,1),(1,2,1),(100,1000,0)으로 절편 포함 제곱손실을 계산합니다. 세 번째 행은 계수나 정규화 분모에 어떤 영향을 주나요?
For assumed rows (X,Y,w)=(0,0,1),(1,2,1),(100,1000,0), fit an intercept line by weighted squared loss. How does row three affect coefficients and normalization?
풀이와 확인할 이유Solution and explanation
양수 가중치 합은 2입니다. 첫 두 행을 정확히 잇는 a=0,b=2가 유일한 최적해이며 세 번째 행은 목적함수에 기여하지 않습니다. 원행 3개는 보존하되 양수 가중 가용 쌍 2개를 구분합니다. w=0은 Y를 모른다는 상태가 아닙니다.
Positive weight sums to two. The unique optimum a=0,b=2 fits the first two rows; row three contributes nothing to the objective. Preserve all three source rows but distinguish the two contributing pairs. Zero weight is not an unavailable Y.
10. 분모 없는 평균An absent denominator
가정 행 (X,Y,w)=(0,1,0),(1,3,0)에서 Σw e²/Σw를 계산하려고 합니다. 손실을 0이라고 출력해야 하나요?
For assumed rows (X,Y,w)=(0,1,0),(1,3,0), consider Σw e²/Σw. Should a program report zero loss?
풀이와 확인할 이유Solution and explanation
분자와 분모가 모두 0이어서 정규화된 위험은 정의되지 않습니다. 모든 계수가 제곱합 0을 만든다는 사실과 확률 법칙의 평균 손실이 정의된다는 사실은 다릅니다. 유효 양수 가중치가 없다는 상태를 표시해야 합니다.
Both numerator and denominator vanish, so normalized risk is undefined. A zero unnormalized sum for every coefficient does not define an average under a probability law. Report the absence of positive contributing weight.
11. 중심 곱에서 기울기Slope from centered products
가정 여섯 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)의 평균은 X=1,Y=5/3입니다. Sxx=4,Sxy=8일 때 절편 포함 OLS 계수를 구하고 평균점 통과를 확인하세요.
For assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5), mean X=1, mean Y=5/3, Sxx=4 and Sxy=8. Find intercept-model OLS and check the mean point.
풀이와 확인할 이유Solution and explanation
기울기 b=8/4=2이고 절편 a=5/3−2=−1/3입니다. X=1에서 예측은 −1/3+2=5/3으로 평균 Y와 같습니다. 이 결과는 관측 제곱손실의 해이며 연습 개입 효과를 별도로 식별하지 않습니다.
The slope is two and intercept −1/3. At mean X=1 the prediction is 5/3, equal to mean Y. These coefficients solve observed squared loss; they do not separately identify a practice intervention effect.
12. 원점의 잔차Residuals from a candidate line
가정 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)에 후보 a=0,b=1을 적용하세요. 잔차 목록·SSE·MSE를 계산하세요.
Apply candidate a=0,b=1 to assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5). Find residuals, SSE and MSE.
Predictions are 0,0,1,1,2,2 and residuals −1,1,−1,1,1,3. SSE=14 and MSE=7/3. Residuals use actual minus predicted, in that order.
13. 최적 잔차 직접 검사Check optimal residuals directly
가정 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)에서 직선 −1/3+2X의 잔차와 두 정상방정식을 확인하세요.
For assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5), check residuals and both normal equations for −1/3+2X.
풀이와 확인할 이유Solution and explanation
잔차는 −2/3,4/3,−5/3,1/3,−2/3,4/3입니다. 합은 0이고 X를 곱한 합은 (−5/3+1/3)+2(−2/3+4/3)=0입니다. 절편과 기울기에 대한 목적함수 미분이 각각 0인 조건입니다.
Residuals are −2/3,4/3,−5/3,1/3,−2/3,4/3. They sum to zero; their X-weighted sum is (−5/3+1/3)+2(−2/3+4/3)=0. These are the objective’s intercept and slope first-order conditions.
14. 기울기 0과 절편 1Zero slope and intercept one
가정 여섯 Y값은 −1,1,0,2,3,5입니다. 모든 행에서 1을 예측할 때 MSE를 직접 구하세요. 평균 Y=5/3, 분산 Y=35/9를 이용한 계산도 하세요.
Assumed outcomes are −1,1,0,2,3,5. Find MSE of constant prediction one directly and using mean 5/3 and variance 35/9.
풀이와 확인할 이유Solution and explanation
제곱오차는 4,0,1,1,4,16으로 합 26, MSE=13/3입니다. 평균 기준 분해는 35/9+(1−5/3)²=35/9+4/9=13/3입니다. 최소 상수 예측은 1이 아니라 평균 5/3입니다.
Squared errors 4,0,1,1,4,16 sum to 26, giving MSE=13/3. The decomposition gives 35/9+(1−5/3)²=13/3. The best constant is mean 5/3, not one.
15. 직교와 조건부 0의 차이Orthogonality versus conditional zero
가정 X=0,1,2가 균등이고 조건부 평균 m=0,1,4입니다. 직선 g=−1/3+2X의 집단 평균 잔차를 구해 전체 평균과 X 곱 평균을 비교하세요.
Assume equally likely X=0,1,2 with conditional means 0,1,4. Find group residual means for g=−1/3+2X and compare their overall and X-weighted means.
풀이와 확인할 이유Solution and explanation
집단 잔차 평균은 1/3, −2/3, 1/3입니다. 전체 평균은 0, X 곱 평균도 (0−2/3+2/3)/3=0입니다. 하지만 세 조건부 평균은 0이 아니므로 두 직교 조건이 조건부 평균 0을 함의하지 않습니다.
Group residual means are 1/3, −2/3, 1/3. Their overall mean and X-weighted mean are zero, yet none is zero within its group. Two orthogonality moments do not imply a zero conditional mean.
16. 최선 직선의 위험 분해Risk decomposition for the best line
가정 X=0,1,2가 균등, 조건부 평균은 0,1,4, 내부 분산은 각각 1입니다. 직선 −1/3+2X의 근사 오차와 전체 위험을 구하세요.
Assume equally likely X=0,1,2, conditional means 0,1,4 and conditional variances one. Find approximation and total risk of −1/3+2X.
풀이와 확인할 이유Solution and explanation
평균 차이는 1/3, −2/3, 1/3이므로 근사 위험은 (1/9+4/9+1/9)/3=2/9입니다. 내부 위험 1을 더하면 11/9입니다. 이는 직선 계수 최적화로 없앨 수 없는 내부 변동과 직선 제약에 따른 근사 오차를 구별합니다.
Mean gaps 1/3, −2/3, 1/3 give approximation risk 2/9. Adding within risk one yields 11/9. The calculation distinguishes within variation from the approximation cost of restricting predictions to a line.
17. 손실 차이의 두 계산Two calculations of the objective gap
가정 여섯 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)에서 최적 계수는 (−1/3,2)입니다. 후보 (0,1)과의 MSE 차이를 dₐ,d_b 및 평균 X=1,분산 X=2/3로 구하세요.
The assumed six-row optimum is (a,b)=(−1/3,2) for rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5). Find the gap at (0,1) using mean X=1 and variance X=2/3.
풀이와 확인할 이유Solution and explanation
dₐ=1/3,d_b=−1입니다. 차이는 (dₐ+d_b평균 X)²+d_b²분산 X=4/9+2/3=10/9입니다. 직접 손실 7/3에서 11/9를 빼도 10/9입니다. 두 계산의 일치는 제곱 전개와 직교의 결과입니다.
The changes are dₐ=1/3,d_b=−1. The gap is (1/3−1)²+2/3=10/9, matching 7/3−11/9. Agreement follows from expanding squares and orthogonality.
18. 모든 가중치의 공통 배수A common multiplier on all weights
가정 행 (0,0),(1,2),(2,1)의 가중치가 (1,2,3)입니다. 모두 7배로 바꾸면 정규화 손실·최적 계수·정규화 전 SSE는 어떻게 바뀌나요?
Assumed rows (0,0),(1,2),(2,1) have weights (1,2,3). What changes if every weight is multiplied by seven?
풀이와 확인할 이유Solution and explanation
Σw e²와 Σw가 둘 다 7배여서 정규화 손실은 모든 계수에서 같습니다. 따라서 최소해도 같습니다. 정규화 전 가중 SSE만 7배입니다. 특정 집단 비중만 바꾸는 경우와 다릅니다.
The numerator and denominator of normalized loss both multiply by seven, so the objective and minimizers are unchanged. Unnormalized weighted SSE multiplies by seven. This differs from changing only selected group weights.
19. 1/2 정규화A factor of one half
모든 값이 유한하고 가중치 w는 비음수이며 W=Σw>0인 가정 자료의 손실을 L=Σw e²/W라고 정의했습니다. 다른 구현은 J=L/2를 씁니다. 최소 계수·최소 손실 수치·gradient는 어떻게 관계되나요?
For an assumed dataset with finite values, nonnegative weights w and W=Σw>0, define L=Σw e²/W and another objective J=L/2. Relate minimizers, minimum values and gradients.
풀이와 확인할 이유Solution and explanation
양수 상수배이므로 최소 계수 집합은 같습니다. J의 최솟값과 gradient 및 Hessian은 L의 절반입니다. 학습률을 포함한 최적화 경로는 같은 숫자 학습률에서 달라질 수 있으므로 정규화를 명시해야 합니다.
Positive rescaling preserves all minimizers. J’s minimum, gradient and Hessian are half those of L. With the same numerical learning rate, an optimization path can differ; state the normalization.
20. 세로 오차의 뜻What vertical errors mean
산점도에서 OLS의 목적이 각 (Xᵢ,Yᵢ)에서 직선까지의 최단 수직거리를 최소화하는 것이라고 한 학생이 말했습니다. 절편 포함 제곱손실 정의를 이용해 고치세요.
A student says scatterplot OLS minimizes shortest perpendicular distances to the fitted line. Correct this using the intercept-model squared-loss definition.
풀이와 확인할 이유Solution and explanation
OLS는 Xᵢ를 고정하고 Yᵢ−a−bXᵢ라는 세로 차이의 제곱을 더합니다. 직교는 n차원 관측공간에서 잔차가 상수 벡터와 X 벡터에 직교한다는 뜻입니다. 산점도의 기울어진 선에 내린 최단거리와는 다른 문제입니다.
OLS fixes Xᵢ and sums squared vertical differences Yᵢ−a−bXᵢ. Orthogonality means residuals are orthogonal to constant and X vectors in n-dimensional observation space, not shortest distances to the slanted scatterplot line.
21. 가중 기울기 직접 계산Calculate the weighted slope
가정 여섯 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)에 가중치 (2, 2, 1, 1, 1, 1)을 둡니다. 가중 평균 X=3/4,Y=5/4, 분산 X=11/16, 공분산=21/16일 때 최적 절편·기울기를 구하세요.
Give assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5) weights (2, 2, 1, 1, 1, 1). Weighted means are 3/4 and 5/4, X variance 11/16 and covariance 21/16. Find the intercept and slope.
풀이와 확인할 이유Solution and explanation
b=(21/16)/(11/16)=21/11입니다. a=5/4−(21/11)(3/4)=−2/11입니다. 조건부 평균 0,1,4는 그대로지만 X 분포가 달라져 최선 직선도 달라졌습니다.
The slope is 21/11 and intercept 5/4−(21/11)(3/4)=−2/11. Conditional means stay 0,1,4, while the changed X distribution changes the best line.
22. 행 복제의 정보Information in copied rows
가정 원행 6개로 계산한 절편 포함 OLS 기울기는 2입니다. 모든 행을 정확히 두 번씩 복사하면 계수와 정규화 MSE가 바뀌나요? 복사본을 독립 관측이라고 선언해도 되나요?
An assumed six-row table has OLS slope two. What happens to coefficients and normalized MSE if every row is copied twice? Can copies be declared independent observations?
풀이와 확인할 이유Solution and explanation
모든 가중치가 같은 배로 늘어난 계산이므로 계수와 MSE는 같습니다. 자료를 복사한 과정은 새로운 독립 단위를 추출한 과정이 아니므로 독립 관측 수가 늘었다고 할 수 없습니다. 표준오차를 줄이려면 실제 의존 구조와 표집 설계를 검토해야 합니다.
Uniform copying preserves coefficients and normalized MSE. Copying data does not sample new independent units. Reducing a standard error requires justified sampling and dependence assumptions, not a larger file alone.
23. SST의 정확 분해Exact SST decomposition
가정 여섯 행 (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5)에 절편 포함 OLS를 적용했습니다. SST=70/3,SSE=22/3일 때 SSR와 중심 R²를 구하고 단위를 쓰세요.
For intercept OLS on assumed rows (0,−1),(0,1),(1,0),(1,2),(2,3),(2,5), SST=70/3 and SSE=22/3. Find SSR and centered R² and state units.
풀이와 확인할 이유Solution and explanation
SSR=70/3−22/3=16입니다. R²=1−(22/3)/(70/3)=24/35입니다. 세 제곱합의 단위는 Y단위²이고 R²는 무차원입니다. 같은 가용 쌍·가중치·절편 포함이라는 분해 조건을 함께 적습니다.
SSR=16 and R²=1−22/70=24/35. Each sum of squares has squared-Y units; R² is dimensionless. The identity uses the same pairs and weights and an intercept optimum.
24. 상수 Y의 R²R² for constant Y
가정 X=(0,1,2),Y=(5,5,5)을 절편 포함으로 회귀합니다. 최소 계수·SSE·SST·R²를 구하세요.
Fit an intercept line to assumed X=(0,1,2),Y=(5,5,5). Find coefficients, SSE, SST and R².
풀이와 확인할 이유Solution and explanation
X가 변하므로 유일한 최적 계수는 a=5,b=0입니다. SSE=0,SST=0이고 1−SSE/SST는 정의되지 않습니다. 완전 적합이라는 말 때문에 R²를 임의로 1로 채우지 않습니다.
Varying X gives unique coefficients a=5,b=0. SSE and SST are both zero, so 1−SSE/SST is undefined. Do not replace the undefined ratio with one merely because the fit is perfect.
25. 절편 제거의 정상방정식Normal equations without an intercept
가정 두 행 (X,Y)=(1,2),(2,3)에서 절편을 0으로 고정했습니다. 최적 기울기와 잔차 합·X 곱 잔차 합을 계산하세요.
For assumed rows (1,2),(2,3), fix the intercept at zero. Find the optimal slope, residual sum and X-weighted residual sum.
풀이와 확인할 이유Solution and explanation
b=(2+6)/(1+4)=8/5입니다. 잔차는 2/5,−1/5이므로 합은 1/5이고 X를 곱한 합은 2/5−2/5=0입니다. 자유로운 절편이 없으므로 잔차 합 0은 요구되지 않습니다.
The slope is 8/5. Residuals 2/5,−1/5 sum to 1/5, while their X-weighted sum is zero. A fixed intercept provides no intercept normal equation.
26. 상수 X의 모든 해Every solution with constant X
가정 X=(2,2),Y=(3,5)에서 절편과 기울기를 모두 허용합니다. 모든 최소 계수와 최소 MSE를 구하세요.
With assumed X=(2,2),Y=(3,5), allow both intercept and slope. Find every minimizing coefficient pair and minimum MSE.
풀이와 확인할 이유Solution and explanation
두 예측은 a+2b로 같아야 하며 최소 상수 예측은 평균 4입니다. 따라서 모든 실수 b에 대해 a=4−2b가 답입니다. 잔차는 −1,1이고 최소 MSE=1입니다. 한 대표 (4,0)을 유일한 계수라고 부르면 틀립니다.
Both fits equal a+2b, whose optimal value is mean four. Every real b with a=4−2b minimizes; residuals −1,1 give MSE one. Representative (4,0) is not unique.
27. 특이 모형의 쿼리Queries in a singular model
가정 X=(2,2),Y=(3,5)의 절편 모형 최소해는 a=4−2b,b는 모든 실수입니다. 쿼리 x=2와 x=3에서 최소해 전체의 예측 집합을 구하세요.
The assumed intercept-model minimizers for X=(2,2),Y=(3,5) are a=4−2b for all real b. Find prediction sets at query x=2 and x=3.
풀이와 확인할 이유Solution and explanation
x=2에서는 4−2b+2b=4로 집합 {4}입니다. x=3에서는 4+b여서 모든 실수입니다. 이것은 동일 목적함수의 최소해들 사이의 차이이며 95% 신뢰구간이나 미래 관측구간이 아닙니다.
At x=2 the set is {4}; at x=3, 4+b spans all real numbers. This is variation across equivalent minimizers, not a confidence or future-observation interval.
28. 영가중치가 특이를 해소할까Can zero weight remove singularity?
가정 행 (X,Y,w)=(2,3,1),(2,5,1),(3,9,0)에 절편 포함 OLS를 적용합니다. 원표에 서로 다른 X가 있다는 이유로 계수가 유일한가요?
Apply intercept OLS to assumed rows (X,Y,w)=(2,3,1),(2,5,1),(3,9,0). Does the distinct X in the full table make coefficients unique?
풀이와 확인할 이유Solution and explanation
아닙니다. 세 번째 행은 손실에 기여하지 않으므로 양수 가중치 설계는 X=2로 상수입니다. 모든 a=4−2b가 같은 최소 MSE=1을 만듭니다. 원표의 서로 다른 값 수와 유효 설계의 변동은 다릅니다.
No. Row three contributes nothing, leaving a constant-X contributing design. Every a=4−2b gives minimum MSE one. Distinct values in the source table do not ensure variation in the effective design.
29. 원점에서 X가 모두 0All-zero X in an origin model
가정 X=(0,0),Y=(3,5)에서 절편을 0으로 고정합니다. 최소 기울기의 집합·예측·MSE를 구하세요.
For assumed X=(0,0),Y=(3,5), fix the intercept at zero. Find minimizing slopes, predictions and MSE.
풀이와 확인할 이유Solution and explanation
어떤 실수 b도 예측 (0,0)을 만듭니다. 따라서 모든 b가 최소해이고 MSE=(9+25)/2=17입니다. b=0이라는 대표만 보여주어도 다른 b가 배제된 것은 아닙니다.
Every real b predicts (0,0), so every b minimizes with MSE=17. A displayed representative b=0 does not exclude the other slopes.
30. 상수지만 0이 아닌 XConstant but nonzero X
가정 X=(2,2),Y=(3,5)에서 절편을 0으로 고정합니다. 절편 포함일 때와 달리 기울기가 유일한 이유를 계산하세요.
For assumed X=(2,2),Y=(3,5), fix the intercept at zero. Explain numerically why the slope is unique unlike the intercept model.
풀이와 확인할 이유Solution and explanation
ΣX²=8>0,ΣXY=16이므로 b=2가 유일합니다. 예측은 4,4, MSE=1입니다. 절편 포함이면 a와 b를 함께 움직일 자유가 있지만, 원점 제약은 a=0으로 그 자유를 제거합니다.
Since ΣX²=8 and ΣXY=16, the unique slope is two. Predictions are 4,4 and MSE one. The origin constraint removes the joint intercept/slope freedom present in the intercept model.
31. 서로 다른 가용 집합의 평균Means from different available subsets
가정 원행 (X,Y)=(0,0),(10,결측),(2,4)에서 Y를 X에 회귀하려 합니다. 전체 X 평균과 완전쌍 X 평균을 구하고 어느 것을 중심화에 써야 하는지 설명하세요.
For assumed rows (0,0),(10,missing),(2,4), regress Y on X. Compare the all-X and complete-pair X means and state which belongs in centering.
풀이와 확인할 이유Solution and explanation
전체 X 평균은 4, 완전쌍 X 평균은 1입니다. 완전쌍 Y 평균 2와 함께 써야 하는 값은 1입니다. 두 완전쌍은 Y=2X에 놓이므로 최적 a=0,b=2입니다. 서로 다른 가용 집합의 평균을 섞으면 이 정상방정식 계산을 재현하지 못합니다.
All-X mean is four; complete-pair X mean is one. Pair the latter with complete-pair Y mean two. The two pairs lie on Y=2X, giving a=0,b=2. Mixing means from different subsets does not implement the same normal equations.
32. 관측 직선과 개입An observed line and intervention
가정 세계 A는 X를 무작위로 정하고 Y(x)=x입니다. 세계 B는 Z가 X=Z,Y=Z를 만들고 X만 강제로 바꾸면 Y=Z를 유지합니다. 두 세계의 관측 X 분포는 같고 유한한 양의 분산을 갖습니다. 관측 OLS와 X를 1만큼 올리는 개입 효과를 비교하세요.
In assumed world A, X is randomized and Y(x)=x. In world B, Z sets X=Z,Y=Z and forcing X alone leaves Y=Z. The two worlds have the same observed X distribution with finite positive variance. Compare observed OLS and intervention effects of increasing X by one.
풀이와 확인할 이유Solution and explanation
X가 변동하면 두 세계 모두 관측 Y=X이므로 a=0,b=1입니다. 개입 효과는 A에서 1,B에서 0입니다. 같은 관측 분포의 회귀만으로 두 반사실 구조를 구별할 수 없습니다.
With varying X, both observed lines have a=0,b=1. Intervention effects are one in A and zero in B. Regression on their identical observational distribution cannot distinguish the counterfactual structures.
33. 직선인 조건부 평균A genuinely linear conditional mean
가정 법칙에서 E[Y|X]=1+3X이고 X,Y의 이차 모멘트가 유한하며 Var(X)>0입니다. 조건부 분산이 X마다 달라도 최선 절편 포함 선형 투영 계수는 무엇인가요?
Assume E[Y|X]=1+3X, finite second moments and Var(X)>0. What are the best intercept-model projection coefficients if conditional variance varies with X?
풀이와 확인할 이유Solution and explanation
모든 예측 함수의 위험은 내부 위험+E[(1+3X−g(X))²]입니다. 직선 g=1+3X는 근사 항을 0으로 만들며 X 변동이 양수여서 a=1,b=3이 유일합니다. 이분산은 그 최소 직선의 계수를 바꾸지 않지만 추론에서는 별도 고려가 필요합니다.
Risk is within risk plus E[(1+3X−g(X))²]. The line a=1,b=3 sets approximation risk to zero and is unique with positive X variance. Heteroskedasticity does not change this population optimum, but matters separately for inference.
34. 집단 평균을 모두 맞춘다면Fitting every observed group mean
가정 X=0,1,2가 균등이고 집단 평균은 0,1,4입니다. g가 각 집단 평균을 그대로 예측할 때, g는 a+bX 형태인가요? 전체 위험이 최소라는 사실로 선형이라고 결론내릴 수 있나요?
Assume equally likely X=0,1,2 with group means 0,1,4. If g predicts those means exactly, is it of form a+bX? Does minimum overall risk imply linearity?
풀이와 확인할 이유Solution and explanation
X가 1 늘 때 평균 증가는 1과 3으로 다르므로 한 직선이 아닙니다. 조건부 평균은 모든 함수 중 제곱위험을 최소화하지만 반드시 직선일 필요는 없습니다. 최소 위험과 선형 함수 제약은 서로 다른 개념입니다.
Successive one-unit mean increases are one and three, so no single line fits all means. A conditional mean minimizes squared risk among all functions without necessarily being linear. Risk optimality and the linear-function restriction are different concepts.
35. 잔차와 오차항의 이름Residuals and an error term
실제 가용 표에 절편 포함 OLS를 적용해 잔차 합이 정확히 0임을 확인했습니다. 이것으로 미지 모집단 구조식의 오차 U가 E[U|X]=0이라고 증명했다고 써도 되나요?
After intercept OLS on an actual available table, residuals sum exactly to zero. Does this prove E[U|X]=0 for an unknown population structural error U?
풀이와 확인할 이유Solution and explanation
안 됩니다. 표본 잔차는 적합 규칙으로 만들어진 값이고 합 0은 그 규칙의 항등식입니다. 구조 오차는 지정한 모형·반사실 의미·모집단 조건에 달린 별개 대상입니다. 실제 표본의 두 직교 조건은 모든 X의 조건부 평균 0보다 약하기도 합니다.
No. Sample residuals are constructed by fitting, and their zero sum is an algebraic identity. A structural disturbance is another object defined by a model, counterfactual meaning and population conditions. Two sample orthogonality moments are also weaker than zero conditional means at every X.
36. 가중 평균점 통과Passing through the weighted mean point
가정 자료의 절편 포함 최소 계수는 a=−2/11,b=21/11이며 같은 가중 법칙의 평균 X=3/4,Y=5/4입니다. 평균점 통과를 계산하고 다른 무가중 평균점을 반드시 지나는지 답하세요.
An assumed weighted intercept fit has a=−2/11,b=21/11 with weighted means X=3/4,Y=5/4. Verify the mean-point identity and whether it must pass through a different unweighted mean point.
풀이와 확인할 이유Solution and explanation
−2/11+(21/11)(3/4)=55/44=5/4입니다. 보장되는 것은 동일 가중 법칙의 평균점입니다. 무가중 평균점이나 다른 가용 집합의 평균점까지 반드시 지난다는 결론은 나오지 않습니다.
The fitted value is −2/11+63/44=55/44=5/4. The guarantee concerns means under the same weights and subset, not arbitrary unweighted or differently selected means.
37. 제곱손실의 유일성 조건A uniqueness condition for squared loss
절편 포함 가정 법칙의 최소점에서 이동한 손실 차이가 (dₐ+d_b평균 X)²+d_b²Var(X)입니다. Var(X)>0일 때 최소 계수의 유일성을 증명하세요.
Suppose an assumed intercept-model loss gap is (dₐ+d_b mean X)²+d_b²Var(X). Prove coefficient uniqueness when Var(X)>0.
풀이와 확인할 이유Solution and explanation
두 항은 모두 비음수입니다. 합이 0이면 두 번째 항 때문에 d_b=0이고 첫 항에서 dₐ=0입니다. 따라서 다른 계수가 같은 최소값을 가질 수 없습니다. Var(X)=0이면 dₐ=−d_b평균 X의 여러 이동이 가능해 이 증명이 유일성을 주지 않습니다.
Both terms are nonnegative. Equality forces d_b=0 because variance is positive, then dₐ=0. No different coefficient pair shares the minimum. With zero variance, movements dₐ=−d_b mean X can preserve loss, so uniqueness fails.
38. 알려진 표와 표집된 표A known table versus a sampled table
같은 가정 표의 최적 기울기 2를 한 연구자는 여섯 행 전체의 기술적 투영으로, 다른 연구자는 미지의 모집단 기울기의 추정량으로 씁니다. 어떤 부분은 같고 무엇을 추가해야 하나요?
Two researchers use slope two from the same assumed six-row table: one as its descriptive projection, another as an estimator of an unknown population slope. What is identical and what must be added?
풀이와 확인할 이유Solution and explanation
입력 행과 작업 가중치·함수 집합이 같으면 계산 계수는 같습니다. 모집단 추정 주장에는 모집단 정의, 추출·응답 과정, 표본과 모집단의 관계가 추가로 필요합니다. 그 조건 없이는 불편성·일치성·신뢰구간을 계산값에서 바로 도출할 수 없습니다.
Identical rows, weights and function class give identical coefficients. A population-estimation claim additionally needs a defined population, selection/response process and a justified sample-population link. Unbiasedness, consistency or intervals do not follow from the arithmetic alone.
39. 경험 조건부 평균의 작은 집단Tiny empirical conditional groups
실제 국가 16행에서 기대수명 X가 모두 달라 각 X에 Y 관측이 하나씩 있습니다. 그 유한 경험 법칙에서 조건부 평균 예측의 잔차가 0인 이유와 이것이 보장하지 않는 것을 설명하세요.
In an actual 16-country table every longevity X differs, leaving one Y per exact X. Explain zero residuals from the empirical conditional-mean rule and what this does not guarantee.
풀이와 확인할 이유Solution and explanation
각 경험 집단이 한 행이므로 그 집단 평균은 그 Y 자체입니다. 따라서 유한 법칙의 내부 분산이 0입니다. 이는 새 국가·새 시점의 조건부 평균이나 관측 잡음이 0임을 보장하지 않습니다. 반복이 없는 경험 집단을 외부 현실의 참 함수로 오해하면 안 됩니다.
A one-row empirical group has mean equal to its Y, so within-group variance is zero under that finite law. This does not establish zero noise or the conditional mean for new countries or dates. A singleton empirical group is not a guarantee about an external true function.
40. 같은 X 분포로 옮길 때Moving a truly linear conditional mean
가정 모집단 A와 B에서 X,Y의 이차 모멘트는 유한하고 E[Y|X]=2+4X가 같으며 각 분산 X가 양수입니다. X 분포가 달라도 절편 포함 최선 직선이 바뀌나요? 비선형 평균 0,1,4 사례와 비교하세요.
Assume populations A and B both have finite second moments of X and Y, E[Y|X]=2+4X and positive X variance. Can different X distributions change their best intercept line? Compare with nonlinear means 0,1,4.
풀이와 확인할 이유Solution and explanation
같은 선형 조건부 평균이 이미 함수 집합에 있으므로 두 모집단의 최선 계수는 a=2,b=4입니다. 반면 비선형 조건부 평균을 한 직선으로 근사하면 X 집단 비중에 따라 최적 근사 계수가 달라질 수 있습니다. 조건부 평균의 형태라는 전제를 빼지 않습니다.
The shared linear conditional mean belongs to the function class, so both optima are a=2,b=4. A line approximating a nonlinear conditional mean can instead change when X masses change. Retain the functional-form premise.
41. 시간에서 분으로Hours to minutes
가정 직선 Y=−1/3+2X에서 X는 시간,Y는 변화 점수입니다. X′=60X로 바꿀 때 새 절편·기울기와 원래 X=2의 예측을 구하세요.
In the assumed line Y=−1/3+2X, X is hours and Y change points. Transform X′=60X and find the new coefficients and prediction at original X=2.
The new line is Y=−1/3+(1/30)X′. Original two hours is 120 minutes, giving the same prediction 11/3. Slope units change from points/hour to points/minute.
42. Y 단위와 MSEOutcome units and MSE
가정 표에서 절편 포함 최적 계수는 a=−1/3,b=2,MSE=11/9입니다. X를 그대로 두고 Y′=100Y로 바꿀 때 계수·MSE·RMSE의 변환을 구하세요.
An assumed intercept fit has a=−1/3,b=2,MSE=11/9. With X unchanged and Y′=100Y, find the transformed coefficients, MSE and RMSE scaling.
The new coefficients are −100/3 and 200. MSE becomes 110000/9, while RMSE multiplies by 100. Squared and square-root loss scales differ.
43. 중심화의 새 절편The centered intercept
가정 직선 −1/3+2X의 원 자료 평균 X=1입니다. X′=X−1로 중심화하면 새 절편은 무엇이며, 원래 절편을 0으로 강제한 모형과 같은가요?
An assumed line is −1/3+2X with original mean X=1. Find the intercept after X′=X−1 and compare with forcing the original intercept to zero.
풀이와 확인할 이유Solution and explanation
X=X′+1을 넣으면 Y=5/3+2X′입니다. 새 절편은 원래 X=1에서의 예측입니다. 원래 절편 0 제약과는 다르며, 단순히 좌표 원점을 바꾼 것이므로 적합값은 같습니다.
Substitution gives Y=5/3+2X′. The new intercept predicts at original X=1. This is a coordinate shift preserving fits, not a constraint that the original intercept vanish.
44. 두 축의 아핀 변환Affine changes on both axes
가정 최적 직선은 Y=−1/3+2X입니다. X′=10+2X,Y′=3+5Y로 바꾸어 새 계수와 원래 X=1 행의 복원 예측을 구하세요.
The assumed best line is Y=−1/3+2X. Transform X′=10+2X,Y′=3+5Y and find coefficients and the restored prediction at original X=1.
풀이와 확인할 이유Solution and explanation
b′=5,a′=3−5/3−50=−146/3입니다. X=1은 X′=12이므로 예측 Y′=34/3입니다. 복원하면 (34/3−3)/5=5/3으로 원래 예측과 같습니다.
The new slope is five and intercept −146/3. Original X=1 gives X′=12 and fitted Y′=34/3. Restoring (34/3−3)/5 gives original prediction 5/3.
45. 음의 X 척도A negative X scale
가정 직선 Y=1+2X에서 X′=−X이고 Y는 그대로입니다. 새 기울기를 구하고 왜 행동 효과가 뒤집혔다고 말할 수 없는지 설명하세요.
In assumed Y=1+2X, let X′=−X while Y stays unchanged. Find the slope and explain why this does not establish a reversed behavioral effect.
풀이와 확인할 이유Solution and explanation
새 식은 Y=1−2X′이므로 기울기는 −2입니다. 더 큰 X′가 더 작은 원래 X를 뜻하도록 방향을 바꾼 결과입니다. 같은 관측행의 예측은 그대로이며 인과 개입에 관한 정보는 추가되지 않습니다.
The new line is Y=1−2X′. Larger X′ means smaller original X; this is coordinate reversal. Original-row predictions stay the same and no causal intervention evidence is added.
46. 척도 0이 안 되는 이유Why a zero scale is excluded
가정 단위변환 X′=tₓ+sₓX에서 sₓ=0으로 두었습니다. 역변환과 원래 기울기를 복원할 수 있나요?
Set sₓ=0 in the assumed coordinate change X′=tₓ+sₓX. Can the inverse transformation or original slope be recovered?
풀이와 확인할 이유Solution and explanation
모든 X가 tₓ 하나로 합쳐지므로 원래 X 정보를 잃습니다. X=(X′−tₓ)/sₓ라는 식은 0으로 나누게 되어 쓸 수 없습니다. 역변환을 전제로 한 단위 실습에서는 0을 거절해야 하며 상수 X 회귀 자체는 별도 해 집합 문제로 다룹니다.
All original X values collapse to tₓ, losing information. The inverse divides by zero and is unavailable. An invertible-unit lab should reject it; regression with genuinely constant X is a separate solution-family problem.
47. 관측 밖의 숫자A number outside observed support
가정 자료에서 X는 0,1,2만 관측되었고 선택한 직선은 −1/3+2X입니다. X=100의 계산값과 그것을 실제 조건부 평균이라고 말할 수 있는지 답하세요.
An assumed dataset observes only X=0,1,2 and selects line −1/3+2X. Evaluate X=100 and state whether it is thereby the actual conditional mean.
풀이와 확인할 이유Solution and explanation
계산값은 599/3입니다. 그러나 이것은 선택 직선을 관측 범위 밖으로 연장한 값입니다. 참 조건부 평균의 형태나 외부 환경이 그 직선을 따른다는 추가 근거 없이는 실제 평균이라고 선언할 수 없습니다.
The calculation gives 599/3. It is an extrapolation of the chosen line beyond observed support, not automatically the true conditional mean. Such a claim needs additional functional and external-environment evidence.
48. 국가 기울기의 단위Country slope units
실제 2024년 16개국 표에서 X는 기대수명 지표(년),Y는 1인당 실질 GDP(2015 USD/명)입니다. 기술적 OLS 기울기 약 3537.588의 단위를 쓰고 수명 개입 효과라는 해석을 평가하세요.
In the actual 2024 table of 16 countries, X is longevity in years and Y real GDP/person in constant-2015 USD. State units of descriptive slope approximately 3537.588 and assess a lifespan-intervention interpretation.
풀이와 확인할 이유Solution and explanation
단위는 기대수명 지표 1년당 2015 USD/명입니다. 선택 국가의 생태적 연관을 요약한 값이며 개인 수명 1년 연장이나 정책 개입의 GDP 효과를 식별하지 않습니다. 국가균등 작업 비중도 인구균등 비중과 다릅니다.
Units are constant-2015 USD/person per year of the longevity indicator. This summarizes an ecological association across selected countries, not an identified GDP effect of extending an individual’s life or implementing a policy. Equal-country working weights also differ from population weights.
49. 원 로그임금의 가용 분모Available source-log-wage denominator
실제 Card 공개 표의 원행은 3613개이고 원 절단 로그임금은 3010개에서 가용합니다. 같은 행의 교육 연수는 가용합니다. 이 결과를 회귀할 때 미관측 수와 사용 쌍 수를 적고 원시급 로그로 채워도 되는지 답하세요.
The actual public Card table has 3613 source rows and 3010 available source-trimmed log wages; schooling is available. Give missing and regression-pair counts and assess substituting logs of raw wages.
풀이와 확인할 이유Solution and explanation
미관측은 603개, 같은 원 결과를 사용하는 가용 쌍은 3010개입니다. 원시급 로그를 넣으면 절단 처리·가용성·결과 정의가 달라질 수 있으므로 같은 변수의 결측 보충으로 몰래 사용하지 않습니다. 변경하려면 별도 표적과 가공을 명시해야 합니다.
There are 603 unavailable outcomes and 3010 pairs for the specified source measure. Logging raw wages can change trimming, availability and outcome definition. Treat it as an explicitly different transformation/target, not a silent replacement.
50. 로그 기울기와 인과 수익률A log slope and causal returns
실제 가용 교육 연수와 원 절단 로그임금의 단순 OLS 기울기는 약 0.052094입니다. 이를 교육 1년의 약 5.2% 인과 수익률로 바로 써도 되나요?
The simple OLS slope of actual available source-trimmed log wages on schooling is approximately 0.052094. May it directly be called a causal schooling return of about 5.2%?
풀이와 확인할 이유Solution and explanation
안 됩니다. 이는 선택한 표에서 교육 1년당 로그임금의 기술적 기울기입니다. 로그 차이를 비율로 옮기는 함수 해석과 교육 개입 효과의 식별은 별개입니다. 누락 요인·선택·코호트·원 변수 절단과 추가 식별 가정을 검토해야 합니다.
No. It is a descriptive source-log-wage slope in a selected table. Mapping a log difference to a percentage and identifying an intervention effect are different tasks. Other determinants, selection, cohort restrictions, trimming and added identification assumptions need examination.
51. 전후 FTE 평균과 기울기Mean FTE change versus slope
실제 완전짝 점포 표의 평균 전 FTE는 정확히 53777/2560=21.006640625, 평균 후 FTE는 정확히 16079/768≈20.936197916666…입니다. 회귀식이 약 Y=10.116555+0.515058X일 때 평균 변화가 0.515058−1인지 답하세요.
Actual complete establishment pairs have exact mean before FTE 53777/2560=21.006640625 and exact mean after FTE 16079/768≈20.936197916666…. The descriptive line is approximately Y=10.116555+0.515058X. Is mean change 0.515058−1?
풀이와 확인할 이유Solution and explanation
아닙니다. 평균 변화는 평균 Y−평균 X=−541/7680≈−0.0704427083 FTE입니다. 절편 포함 평균점 항등식을 쓰면 a+(b−1)평균 X입니다. b−1만은 Y−X를 X에 회귀할 때의 기울기이지 평균 변화가 아닙니다.
No. Mean change is mean Y−mean X=−541/7680≈−0.0704427083 FTE. The mean-point identity gives a+(b−1)mean X. Slope b−1 belongs to regression of Y−X on X, not the overall mean change.
52. 원행 키와 중복 코드Source positions and duplicate codes
실제 NJ/PA 자료에서 store 코드 407의 원행 42는 FTE 11→11, 원행 168은 12→14.5입니다. 코드를 유일 키라고 가정해 합치면 무엇이 달라지나요?
In actual NJ/PA data, store code 407 occurs at source row 42 with FTE 11→11 and row 168 with 12→14.5. What goes wrong if the numeric code is assumed unique and merged?
풀이와 확인할 이유Solution and explanation
서로 다른 조사 기록과 전후 연결이 바뀔 수 있습니다. 원행별 변화 0과 2.5를 각각 보존해야 하며 두 코드를 보았다는 이유만으로 같은 점포의 반복 조사라고 단정하지 않습니다. 원행 번호는 보관 위치 키이지 새로운 독립성 증거도 아닙니다.
Distinct survey records and within-row wave pairs can be changed. Retain changes zero and 2.5 separately; repeated numeric codes alone do not prove one establishment’s repeated observations. Source positions identify retained locations, not independence.
53. 변화 회귀의 정확 관계The exact change-regression relation
같은 가용 쌍·가중치·절편에서 Y를 X에 회귀한 해가 a,b이고 X 변동이 양수입니다. 결과를 Z=Y−X로 바꾸면 새 절편·기울기·잔차는 어떻게 되나요?
For the same available pairs, weights and intercept, regressing Y on varying X gives coefficients a,b. Replace the outcome with Z=Y−X. Find new coefficients and residuals.
풀이와 확인할 이유Solution and explanation
Z−a−(b−1)X=Y−a−bX이므로 잔차가 완전히 같습니다. 계수는 a와 b−1이며 잔차 제곱손실도 같습니다. 새 평균 Z는 평균 Y−평균 X이고 기울기 b−1 자체와 같을 필요는 없습니다.
The identity Z−a−(b−1)X=Y−a−bX preserves every residual. New coefficients are a,b−1 with the same squared residual loss. Mean Z equals mean Y−mean X and need not equal b−1.
54. 정밀한 숫자와 표본 불확실성Precise arithmetic and sampling uncertainty
한 프로그램이 실제 표의 OLS를 정확 분수로 계산했습니다. 그 분수에 반올림이 없다는 이유로 미지 모집단 기울기의 불확실성도 0이라고 결론내릴 수 있나요?
A program calculates OLS on an actual table with exact fractions. Does absence of arithmetic rounding imply zero uncertainty about an unknown population slope?
풀이와 확인할 이유Solution and explanation
아닙니다. 산술 정밀도는 주어진 표에서의 계산 문제입니다. 모집단 불확실성에는 표집·응답·의존·모형 조건이 필요합니다. 정확한 유한 표 요약도 선택된 표의 요약일 수 있으며, 작은 반올림과 작은 추정 오차는 다른 말입니다.
No. Arithmetic precision concerns calculation conditional on the table. Population uncertainty needs sampling, response, dependence and model conditions. An exact finite-table summary can still describe a selected table; rounding error and estimation error are different.
55. 연속 비선형 평균의 투영Projecting a continuous nonlinear mean
가정 X는 [0,1] 균등이고 Y=X²입니다. E[X]=1/2,E[X²]=1/3,E[X³]=1/4,E[X⁴]=1/5를 이용해 최선 절편 포함 직선과 위험을 구하세요.
Assume X is uniform on [0,1] and Y=X². Using moments 1/2,1/3,1/4,1/5, find the best intercept line and its risk.
풀이와 확인할 이유Solution and explanation
분산 X=1/12, 공분산(X,Y)=1/4−(1/2)(1/3)=1/12이므로 b=1,a=1/3−1/2=−1/6입니다. 위험은 E[(X²−X+1/6)²]=1/5−1/2+4/9−1/6+1/36=1/180입니다. 참 조건부 평균 X²의 위험 0보다 큰 직선 근사 오차입니다.
Var(X)=1/12 and Cov(X,Y)=1/12, so b=1,a=−1/6. Risk E[(X²−X+1/6)²]=1/5−1/2+4/9−1/6+1/36=1/180. This is line approximation error; the true conditional mean X² has zero risk.
56. 직교하지만 집단별로 다른 오차Orthogonal but group-dependent errors
가정 X=−1,0,1이 각각 확률 1/3이고 Y는 각각 1,−2,1입니다. E[Y],E[XY]와 절편 포함 최선 직선을 구하고 E[Y|X]=0인지 답하세요.
Assume X=−1,0,1 each have probability 1/3 and corresponding Y=1,−2,1. Find E[Y],E[XY], the best intercept line and whether E[Y|X]=0.
풀이와 확인할 이유Solution and explanation
E[Y]=0,E[XY]=(−1+0+1)/3=0이므로 양수 분산 X에서 a=0,b=0입니다. 그러나 조건부 평균은 1,−2,1로 0이 아닙니다. 최선 선형 예측이 0이라는 사실과 참 조건부 평균이 0이라는 사실은 다릅니다.
E[Y]=0 and E[XY]=0, so positive X variance gives a=0,b=0. Conditional means remain 1,−2,1, not zero. A zero best linear predictor does not imply a zero conditional mean.
57. 대표 계수의 좌표 대응Mapping a representative coefficient
가정 상수 X=2,Y=(3,5)의 최소 계수 가족은 a=4−2b입니다. X′=X−2,Y′=10Y로 바꾸면 최소해 가족과 관측 적합값은 무엇인가요?
The assumed minimizing family for constant X=2,Y=(3,5) is a=4−2b. Transform X′=X−2,Y′=10Y. Find the new minimizing family and observed fitted values.
풀이와 확인할 이유Solution and explanation
모든 관측 X′=0이고 평균 Y′=40입니다. 따라서 새 절편은 40, 새 기울기는 모든 실수가 가능하며 관측 적합값은 40입니다. 원래 b와 새 b′=10b가 일대일로 대응합니다. 특이가 사라진 것이 아니라 같은 해 가족의 좌표를 바꾼 것입니다.
All observed X′=0 and mean Y′=40. The new intercept is 40 and every real slope minimizes, predicting 40 on support. Original b maps one-to-one to b′=10b. The transformation re-expresses singularity rather than removing it.
58. 소프트웨어 잔차 검사A software residual check
실제 가용 표에서 절편 포함 가중 OLS를 계산한 뒤 Σw e와 ΣwXe가 작은 소수로 남았습니다. 정확 산술 결과가 0일 때 이 사실과 인과 가정을 어떻게 보고하나요?
After weighted intercept OLS on actual available pairs, software leaves tiny decimal Σw e and ΣwXe although exact arithmetic gives zero. How should this and causal assumptions be reported?
풀이와 확인할 이유Solution and explanation
유한 정밀도 반올림의 허용오차와 정확 분수 검사를 별도로 기록합니다. 정확 직교는 선택한 제곱손실의 산술 항등식입니다. 그 항등식이 정책 외생성·교육 인과효과·독립 표집을 검증했다는 문장은 쓰지 않습니다.
Report floating-point tolerances separately from exact-fraction checks. Exact orthogonality is an algebraic property of the selected squared-loss fit. It does not verify policy exogeneity, a causal schooling effect or independent sampling.
59. 재현 코드의 입력Inputs to reproduction code
실제 자료 재현 프로그램 A는 이미 계산한 case JSON에서 계수를 읽어 출력합니다. B는 원 API/ZIP 또는 명시된 공개 선택 CSV에서 같은 가용 쌍을 다시 읽고 중심화 곱을 계산합니다. 어떤 검증 차이가 있나요?
Reproduction program A reads calculated coefficients from a case JSON. B rereads original API/ZIP bytes or a disclosed public selection CSV and computes centered products. What differs?
풀이와 확인할 이유Solution and explanation
A는 저장값 전달은 검사하지만 계수 계산을 독립 재현하지 않습니다. B는 입력 해시·선택·분모·변환을 기록하면 산술을 다시 수행합니다. 그래도 원 측정의 정확성·대표성·인과 식별까지 자동 검증되는 것은 아니므로 검토 범위를 분리합니다.
A checks delivery of stored outputs, not independent recalculation. B recomputes arithmetic while recording hashes, selection, denominators and transformations. It still does not automatically certify measurement truth, representation or causal identification.
60. 작은 보고서 완성Complete a small report
전부 가정한 두 기록은 X=0,Y=1과 X=1,Y=3이며 비중은 같습니다. 절편 포함 OLS의 대상·계수·잔차·보장하지 않는 결론을 갖춘 짧은 보고서를 작성하세요.
Two wholly assumed equal-weight records are (X,Y)=(0,1),(1,3). Write a short report stating the intercept OLS target, coefficients, residuals and a conclusion it does not establish.
풀이와 확인할 이유Solution and explanation
이 보고서는 알려진 두 행의 균등 유한 법칙에서 제곱위험이 가장 작은 직선을 기술한다. 평균 X=1/2,Y=2, 기울기 2,절편 1이고 두 잔차와 최소 손실은 0이다. 관측 범위는 0~1이다. 표본 추출·개입 조건이 제시되지 않아 모집단 무오차 예측이나 X의 인과효과를 식별했다는 결론은 내리지 않는다.
This report describes the squared-risk minimizing line under a known equal-weight two-row law. Mean X=1/2, mean Y=2, slope two and intercept one give zero residuals and minimum loss zero over observed range 0–1, with positive-mass support {0,1}. Without a sampling or intervention design, this does not identify error-free population prediction or a causal effect of X.
자료별 확보일·원행 식별·단위·이용 조건은 출처 기록을 확인하세요. 학습 사본은 제공처의 현재 최신 자료와 다를 수 있습니다.Consult each source record for retrieval dates, row identifiers, units and terms. Teaching copies can differ from current provider releases.