### Linear Regression with Quantitative and Qualitative Predictors

```Experiments with Bullet Proof Panels and
Various Bullet Types
R.A. Prosser, S.H. Cohen, and R.A. Segars (2000). "Heat as a Factor of Cloth Ballistic Panels by 0.22
Caliber Projectiles," Textile Research Journal, Vol. 70: pp. 709-723.
Data Description
• Response: V50 – The velocity at which approximately
half of a set of projectiles penetrate a fabric panel
(m/sec)
• Predictors:
 Number of layers in the panel (2,6,13,19,25,30,35,40)
 Bullet Type (Rounded, Sharp, FSP)
• Transformation of Response: Y* = (V50/100)2
• Two Models:
 Model 1: 3 Dummy Variables for Bullet Type, No Intercept
 Model 2: 2 Dummy Variables for Bullet Type, Intercept
Data/Models (t=3, bullet type, ni=9 layers per bullet type)
BulletType
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
#Layers
2
6
13
19
25
30
35
40
2
6
13
19
25
30
35
40
2
5
10
15
20
25
30
35
40
V50
213.1
295.4
410.8
421.8
520.0
534.9
571.1
618.4
266.1
328.9
406.3
469.7
550.5
597.7
620.0
671.5
236.8
306.6
391.4
435.6
484.9
524.6
587.7
617.5
669.0
Y*
4.541
8.726
16.876
17.792
27.040
28.612
32.616
38.242
7.081
10.818
16.508
22.062
30.305
35.725
38.440
45.091
5.607
9.400
15.319
18.975
23.513
27.521
34.539
38.131
44.756
Rounded
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Sharp
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
M odel 1 (N o Intercept, 3 D um m y V ariables ): Yij   i 0   i 1 X ij   ij
FSP
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
i  1, ..., t  3;
j  1, ..., n i  9
M odel 2 (Intercept, 2 D um m y V ariables): Yi   0   L L i   S S i   F Fi   L S L i S i   L F L i Fi   i
w here: L  # of layers
 1 if B ullet T ype = S harp
S 
 0 otherw ise
1 if B ullet T ype = FS P
F 
 0 otherw ise
i  1, ..., n 
Model 1 – Individual Intercepts/Slopes
t  3 groups (B ullet T ypes)
1


1

0
X  

0
0



0

 n1

 n1
 X 1 j
 j 1

0

X 'X  
0



0


0

n i observations per bullet type
X 11
0
0
0
X 18
0
0
0
0
1
X 21
0
0
1
X 28
0
0
0
0
1
0
0
0
1



0 

0 


0 
X 31 



X 39 
0
  10 



 11 
  20 
β 

  21 
 
30


  3 1 
n1

X1j
0
0
0
0
2
0
0
0
0
0
0
0
0
j 1
n1

X1j
j 1
n2
0

n2
X2j
j 1
n2
0

j 1
n2
X2j

2
X2j
j 1
n3
0
0
0

n3
j 1
n3
0
0
0

j 1
n3
X3j

j 1














X3j


2
X3j

 n1
 n 2  8, n 3  9 
 Y1 1 




 Y1 8 


Y2 1 

Y  


Y2 8 
Y 
 31 




 Y3 9 
 n1

  Y1 j

 j 1

 n1

X
Y
 1 j 1 j 
 j 1

 n2

 Y

2 j
 j 1

X 'Y  

n2

X 2 jY2 j 


j 1


n
 3

  Y3 j

 j 1

n
3


  X 3 j Y3 j 
 j 1

Model 2 – Dummy Coding (Sharp (j=2), FSP (j=3))
S  1 if B ullet T ype = S harp, 0 otherw ise
1


1

1
X  

1
1



1

 n

 n

 Li
 i 1


 n2
X 'X  

 n3

 n1  n 2

 Li
 i  n1  1
 n


Li
 
 i  n1  n 2  1
F  1 if B ullet T ype = FS P , 0 otherw ise
L1
0
0
0
L8
0
0
0
L9
1
0
L10
L16
1
0
L18
L17
0
1
0
L 25
0
1
0



0 

0 


0 
L19 



L 27 
0
0


 1
S
β 
F

LS

  L F
n  n2
n

n2

n3
i 1
Li
i  n1  1
n  n2
n

L

i 1
n  n2
n
1
2
i

Li
i  n1  1
1
Li
i  n1  n 2  1
2
Li
i  n1  1
n  n2
n  n2
1


1
Li
n2

0
i  n1  1
Li
i  n1  1
n

Li
0
n3
0
i  n1  n 2  1
n  n2
n  n2
1

L

i  n1  1
i  n1  n 2  1
1
Li

0
i  n1  1
n

n  n2
1
2
i
i  n1  1
n
2
Li
0

i  n1  n 2  1
Li
0

L
 i
i  n1  n 2  1


n
2
 Li 
i  n1  n 2  1


0


n

L
 i
i  n1  n 2  1



0


n
2 
 Li 
i  n1  n 2  1

n
1
Li









2
Li
n   n1  n 2  n 3  2 5
 Y1 




 Y8 


 Y9 

Y  


 Y1 6 
Y 
 17 




Y2 5 
 n

  Yi

 i 1

 n

L
Y
 i i

 i 1

 n1  n 2

  Yi

i

n

1
 1

X 'Y   n


  Y 
i
 i  n1  n 2  1

 n n

1
2


LY
  i i 
i  n 1
 1

n


  L i Yi 
 i  n1  n 2  1

Model 1 – Matrix Formulation
Y
4.541
8.726
16.876
17.792
27.040
28.612
32.616
38.242
7.081
10.818
16.508
22.062
30.305
35.725
38.440
45.091
5.607
9.400
15.319
18.975
23.513
27.521
34.539
38.131
44.756
X
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6
13
19
25
30
35
40
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6
13
19
25
30
35
40
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5
10
15
20
25
30
35
40
X'X
8
170
0
0
0
0
170
4920
0
0
0
0
0
0
8
170
0
0
0
0
170
4920
0
0
0
0
0
0
9
182
0
0
0
0
182
5104
INV(X'X)
0.470363 -0.01625
0
0
0
0
-0.01625 0.000765
0
0
0
0
0
0
0.470363 -0.01625
0
0
0
0
-0.01625 0.000765
0
0
0
0
0
0
0.398377 -0.01421
0
0
0
0
-0.01421 0.000702
Y'Y
Beta'X'Y
SSE
18080.75 18052.51 28.24122
dfE
19
MSE
1.48638
V(beta-hat)
0.69914 -0.02416 0.00000 0.00000 0.00000 0.00000
-0.02416 0.00114 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.69914 -0.02416 0.00000 0.00000
0.00000 0.00000 -0.02416 0.00114 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.59214 -0.02111
0.00000 0.00000 0.00000 0.00000 -0.02111 0.00104
X'Y
174.44
4824.43
206.03
5691.26
217.76
5815.29
Beta-hat
3.643
0.855
4.412
1.004
4.142
0.992
Model 2 – Matrix Formulation
X
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
X'X
2
6
13
19
25
30
35
40
2
6
13
19
25
30
35
40
2
5
10
15
20
25
30
35
40
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
2
6
13
19
25
30
35
40
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5
10
15
20
25
30
35
40
25
522
8
9
170
182
INV(X'X)
0.470363
-0.01625
-0.47036
-0.47036
0.016252
0.016252
522
14944
170
182
4920
5104
-0.01625
0.000765
0.016252
0.016252
-0.00076
-0.00076
8
170
8
0
170
0
-0.47036
0.016252
0.940727
0.470363
-0.0325
-0.01625
Y'Y
Beta'X'Y
SSE
18080.75 18052.51 28.24122
9
182
0
9
0
182
170
4920
170
0
4920
0
-0.47036
0.016252
0.470363
0.86874
-0.01625
-0.03046
0.016252
-0.00076
-0.0325
-0.01625
0.00153
0.000765
dfE
19
MSE
1.48638
182
5104
0
182
0
5104
X'Y
598.23
16330.98
206.03
217.76
5691.26
5815.29
0.016252
-0.00076
-0.01625
-0.03046
0.000765
0.001467
Beta-hat
3.643
0.855
0.769
0.499
0.150
0.137
V(beta-hat)
0.69914 -0.02416 -0.69914 -0.69914 0.02416 0.02416
-0.02416 0.00114 0.02416 0.02416 -0.00114 -0.00114
-0.69914 0.02416 1.39828 0.69914 -0.04831 -0.02416
-0.69914 0.02416 0.69914 1.29128 -0.02416 -0.04527
0.02416 -0.00114 -0.04831 -0.02416 0.00227 0.00114
0.02416 -0.00114 -0.02416 -0.04527 0.00114 0.00218
Equations Relating Y to #Layers by Bullet Type
M odel 1 (S eparate Intercepts and S lopes by B ullet T ype):
R ounded ( i  1) :
^
^
Y 1 j   10   11 X 1 j  3.643  0.855 X 1 j
^
^
^
Y2j  
S harp ( i  2) :
FS P ( i  3) :
^
^
20
^

21
j  1, ..., 8
X 2 j  4.412  1.004 X 2 j
^
Y 3 j   30   31 X 3 j  4.142  0. 992 X 1 j
j  1, ..., 8
j  1, ..., 9
M odel 2: D um m y C oding for S harp and FS P , w ith R ounded as "B aseline C ategory"
R ounded ( S  0, F  0) :
^
^
^
Yi=0+
^
^
^
Yi=0+
S harp ( S  1, F  0) :
FS P ( S  0, F  1) :
^
^
Yi=0+
L
^
L i +  S (1)  
^
L i +  F (1)  
 3.643  0.499    0.855  0.137  L i
LS
LF
i  1, ..., 8
L i (1) 
 4.412  1.005 L i
^
L
L i  3.643  0.855 L i
^
 3.643  0.769    0.855  0.150  L i
^
L
i  9, ...,16
L i (1) 
 4.142  0.992 L i
i  17, ..., 25
Note: Both models give the same lines (ignore rounding for Sharp). Same lines would
be obtained if Baseline Category had been Sharp or FSP.
Tests of Hypotheses
• Equal Slopes: Allowing for Differences in Bullet Type
Intercepts, is the “Layer Effect” the same for each
Bullet Type?
• Equal Intercepts (Only Makes sense if all slopes are
equal): Controlling for # of Layers, are the Bullet Type
Effects all Equal?
• Equal Variances: Do the error terms of the t = 3
regressions have the same variance?
Testing Equality of Slopes
M odel 1: E Yij    i 0   i 1 X ij
i  1, 2, 3;
R educed M odel 1: E Yij    i 0   1 X ij
j  1, ..., n i
i  1, 2, 3;
H 0 :  11   21   31   1
j  1, ..., n i
M odel 2: E Yi    0   L L i   S S i   F Fi   L S L i S i   L F L i Fi
i  1, ..., 25
H 0 :  LS   LF  0
R educed M odel 2: E Yi    0   L L i   S S i   F Fi
Complete Models (Both 1 and 2)
Y'Y
Beta'X'Y
SSE
18080.75 18052.51 28.24122
Beta-hat
3.643
0.855
0.769
0.499
0.150
0.137
Model 2
TS :
Fobs
dfE
19
Reduced Models (Both 1 and 2)
MSE
1.48638
 46.44  28.24 

 9.10
21  19




 6.11
28.24
1.49


 19 


Conclude Slopes are not all equal
Y'Y
Beta'X'Y
SSE
18080.75 18034.32 46.43796
RR :
Fobs  F  .05; 2,19   3.522
dfE
21
MSE
2.211332
Beta-hat
1.588
0.951
3.948
3.368
Model 2
V50^2 versus Number of Panels
by Bullet Type - Full Model (HA)
V50^2 versus Number of Panels by
Bullet Type - Reduced Model (H0)
60
60
50
50
40
40
Sharp(F)
30
FSP(F)
20
Sharp(R)
30
FSP(R)
Round
Round
Sharp
Sharp
FSP
10
Round(R)
V50^2
V50^2
Round(F)
20
FSP
10
0
0
0
10
20
30
Number of Panels
40
50
0
10
20
30
Number of Panels
40
50
Testing Equality of Intercepts – Assuming Equal Slopes
Note: Does not apply to this problem, just providing formulas.
M odel 1: E Yij    i 0   1 X ij
i  1, 2, 3;
R educed M odel 1: E Yij    0   1 X ij
j  1, ..., n i
i  1, 2, 3;
M odel 2: E Yi    0   L L i   S S i   F Fi
H 0 :  10   20   30   0
j  1, ..., n i
i  1, ..., 25
H 0 : S  F  0
R educed M odel 2: E Yi    0   L L i
T S : Fobs
 SSE ( R )  SSE ( F ) 


n

2

n

4
   
 

 SSE ( F ) 


 n  4 
R R : Fobs  F   ; 2, n   4 
w here SSE  R esidual S um of S quares
Bartlett’s Test of Equal Variances
B ased on M odel 1 (S im ilar for M odel 2), O btain S am ple V ariance for E ach G roup ( t  3) :
ni
^


SSE i    Yij  Y ij 

j 1 
t
SSE 
 SSE
2
si 
2
SSE i
t
i
i 1


M SE 
2
s
i i
i 1
 t 1
1 
C  1




i



3  t  1   i 1

1
R eject H 0 : 
2
SSE


2
1j
n  2 t
1 
B 
  ln  M SE  
C 
1.0706
1.9199
5.9915
0.3829
2
2 j
2
7.0871
6
1.1812
0.9991
0.1667
 i  n i  2 for these sim ple regressions
S SE
       ...    
i
1
SSE(i)
15.1594
df(i)
6
s^2(i)
2.5266
df(i)*ln(s^2(i)) 5.5612
1/df(i)
0.1667
C
B
X2(.05;3-1)
P-Value
i  1, ..., t
i
tj
3
5.9948
7
0.8564
-1.0851
0.1429
if B  
Total
28.2412
19
1.4864
7.5305
0.0526
2
t

i 1
i
2 
ln  s i  

 ; t  1 
MSE
Residuals
Round
Sharp
-0.8115 0.6603
-0.0453 0.3797
2.1214 -0.9601
-2.0909 -1.4321
2.0295
0.7852
-0.6722 1.1832
-0.9419 -1.1229
0.4110
0.5067
FSP
-0.5181
0.2999
1.2606
-0.0423
-0.4625
-1.4131
0.6473
-0.7195
0.9477
```