I've seen multiple explanations of comparisons of heteroscedasticity tests, but am still confused. (Part of the problem is that some of it is quite technical and has lost me.)
I've collected a few heteroscedasticity test functions in R and compared the results, some of which baffle me.
Here's a graph of a linear regression: To my untrained eye, the data look heteroscedastic.
I've run a few tests for confirmation:
> reg <- lm(est~emp_app, temp)
> lmtest::bptest(reg,studentize=TRUE)
studentized Breusch-Pagan test
data: reg
BP = 174.53, df = 1, p-value < 2.2e-16
> lmtest::bptest(reg,studentize=FALSE)
Breusch-Pagan test
data: reg
BP = 4163.8, df = 1, p-value < 2.2e-16
> car::ncvTest(reg) #original Breusch-Pagan
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 4163.766 Df = 1 p = 0
> res <- gvlma::gvlma(reg)
> gvlma::display.gvlmatests(res)
ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance = 0.05
Call:
gvlma::gvlma(x = reg)
Value p-value Decision
Global Stat 3.378e+04 0.0000 Assumptions NOT satisfied!
Skewness 4.505e+02 0.0000 Assumptions NOT satisfied!
Kurtosis 3.318e+04 0.0000 Assumptions NOT satisfied!
Link Function 1.504e+02 0.0000 Assumptions NOT satisfied!
Heteroscedasticity 2.137e-01 0.6439 Assumptions acceptable.
As I understand, the first three tests report heteroscedasticity with very low p-values, but the fourth rejects it quite squarely. How can the tests disagree so strongly?
Here's my data:
temp<-structure(list(cbsa_code = c("10180", "10420", "10500", "10540",
"10580", "10740", "10780", "10900", "11020", "11100", "11180",
"11260", "11460", "11500", "11540", "11700", "12020", "12060",
"12100", "12220", "12260", "12420", "12540", "12580", "12620",
"12700", "12940", "12980", "13020", "13140", "13220", "13380",
"13460", "13740", "13780", "13820", "13900", "13980", "14010",
"14020", "14100", "14260", "14460", "14500", "14540", "14740",
"14860", "15180", "15260", "15380", "15500", "15540", "15680",
"15940", "15980", "16020", "16060", "16180", "16220", "16300",
"16540", "16580", "16620", "16700", "16740", "16820", "16860",
"16940", "16980", "17020", "17140", "17300", "17420", "17460",
"17660", "17780", "17820", "17860", "17900", "17980", "18020",
"18140", "18580", "18700", "18880", "19060", "19100", "19140",
"19180", "19300", "19340", "19380", "19460", "19500", "19660",
"19740", "19780", "19820", "20020", "20100", "20220", "20260",
"20500", "20700", "20740", "20940", "21060", "21140", "21300",
"21340", "21500", "21660", "21780", "21820", "22020", "22140",
"22180", "22220", "22380", "22420", "22500", "22520", "22540",
"22660", "22900", "23060", "23420", "23460", "23540", "23580",
"23900", "24020", "24140", "24220", "24260", "24300", "24340",
"24420", "24500", "24540", "24580", "24660", "24780", "24860",
"25060", "25180", "25220", "25260", "25420", "25500", "25540",
"25620", "25860", "25940", "25980", "26140", "26300", "26380",
"26420", "26580", "26620", "26820", "26900", "26980", "27060",
"27100", "27140", "27180", "27260", "27340", "27500", "27620",
"27740", "27780", "27860", "27900", "27980", "28020", "28100",
"28140", "28420", "28660", "28700", "28740", "28940", "29020",
"29100", "29180", "29200", "29340", "29420", "29460", "29540",
"29620", "29700", "29740", "29820", "29940", "30020", "30140",
"30300", "30340", "30460", "30620", "30700", "30780", "30860",
"30980", "31020", "31080", "31140", "31180", "31340", "31420",
"31460", "31540", "31700", "31740", "31860", "31900", "32580",
"32780", "32820", "32900", "33100", "33140", "33220", "33260",
"33340", "33460", "33540", "33660", "33700", "33740", "33780",
"33860", "34060", "34100", "34580", "34620", "34740", "34820",
"34900", "34940", "34980", "35100", "35300", "35380", "35620",
"35660", "35840", "35980", "36100", "36140", "36220", "36260",
"36420", "36500", "36540", "36740", "36780", "36980", "37100",
"37340", "37460", "37620", "37860", "37900", "37980", "38060",
"38220", "38300", "38340", "38540", "38860", "38900", "38940",
"39140", "39300", "39340", "39380", "39460", "39540", "39580",
"39660", "39740", "39820", "39900", "40060", "40140", "40220",
"40340", "40380", "40420", "40580", "40660", "40900", "40980",
"41060", "41100", "41140", "41180", "41420", "41500", "41540",
"41620", "41660", "41700", "41740", "41860", "41940", "42020",
"42100", "42140", "42200", "42220", "42340", "42540", "42660",
"42680", "42700", "43100", "43300", "43340", "43420", "43580",
"43620", "43780", "43900", "44060", "44100", "44140", "44180",
"44220", "44300", "44420", "44700", "44940", "45060", "45220",
"45300", "45460", "45500", "45540", "45780", "45820", "45940",
"46060", "46140", "46220", "46340", "46520", "46540", "46660",
"46700", "47020", "47220", "47260", "47300", "47380", "47460",
"47580", "47900", "47940", "48060", "48140", "48260", "48300",
"48540", "48620", "48660", "48700", "48900", "49020", "49180",
"49340", "49420", "49620", "49660", "49700", "49740"), emp_app = c(59998,
294127, 45814, 35251, 344504, 293984, 49098, 313182, 54469, 95485,
32074, 166243, 148265, 35910, 112362, 159295, 59932, 2241972,
103524, 41553, 186878, 773940, 194840, 1139580, 57350, 74140,
337264, 53395, 30703, 134579, 34931, 73743, 60309, 72287, 79217,
445349, 59192, 51175, 82343, 52204, 36838, 242687, 2421578, 150110,
57912, 57374, 421295, 104560, 32901, 476709, 56328, 102068, 28799,
147570, 201523, 40052, 40758, 21200, 36096, 129661, 49464, 75399,
89688, 262866, 988186, 82306, 215347, 35530, 4120166, 59475,
907677, 68582, 39401, 923418, 47532, 70268, 232291, 75408, 284984,
95823, 46808, 836802, 163715, 25919, 78046, 31188, 2954801, 56250,
24983, 58868, 159359, 318802, 44878, 45585, 158021, 1211011,
307055, 1709983, 49354, 51662, 55142, 109624, 241065, 44970,
72853, 33153, 40291, 123927, 31597, 229609, 114164, 123022, 140182,
27673, 120979, 39736, 97042, 199864, 50051, 117246, 74128, 46700,
42920, 120470, 93234, 191745, 249702, 29603, 92134, 72187, 28508,
41666, 33461, 43601, 35966, 51843, 474938, 21420, 30802, 85157,
156091, 318528, 60323, 322404, 127159, 83253, 35571, 23393, 271533,
51459, 533971, 50122, 127573, 60115, 12898, 27791, 32412, 81983,
2576412, 111891, 172187, 50584, 856951, 67841, 49525, 48974,
216677, 56192, 534828, 35491, 56646, 52435, 63657, 46531, 44177,
69998, 61999, 121603, 36979, 923782, 79661, 103572, 104648, 45604,
324448, 32084, 65354, 195811, 69714, 75839, 41520, 174572, 226286,
160786, 75850, 50155, 824659, 40240, 34425, 44109, 21824, 45347,
219269, 46122, 139267, 275443, 43653, 85075, 30598, 5456991,
560894, 113641, 97143, 82500, 26580, 316916, 179115, 29258, 48648,
44133, 187842, 70228, 527509, 42036, 2122149, 34473, 34633, 91487,
775911, 1778005, 49149, 148864, 135488, 66903, 36847, 129973,
51192, 38306, 39772, 39382, 53027, 126884, 62275, 118795, 797655,
30768, 335845, 496807, 8123112, 53404, 232638, 102909, 80011,
26513, 65095, 177240, 504306, 68684, 414460, 991947, 82979, 46639,
257011, 169860, 65829, 32257, 126500, 165198, 2563343, 1619025,
22919, 1094529, 53467, 24406, 231298, 978967, 111852, 57307,
616068, 192435, 48828, 37485, 69285, 481122, 54861, 154975, 49163,
179215, 523449, 1118924, 138842, 108519, 443427, 133966, 48602,
34336, 697430, 79117, 97391, 45178, 48349, 1223383, 114637, 106652,
123924, 582047, 41413, 825174, 1239334, 2045647, 1010970, 91540,
75572, 46233, 146504, 166604, 147128, 236587, 1626232, 42560,
19861, 54832, 39777, 156849, 26092, 77546, 136675, 126814, 130867,
189825, 86462, 227956, 179168, 41116, 44884, 39796, 173611, 32393,
258000, 110022, 1080271, 56795, 46653, 20144, 271481, 85504,
188908, 310979, 403144, 80890, 91548, 355607, 99886, 43020, 107550,
36273, 44519, 603621, 94155, 103218, 20122, 45576, 2559666, 81913,
29527, 64477, 35986, 35650, 56778, 265128, 47202, 46211, 99208,
52110, 231599, 319287, 66044, 164072, 197478, 30114, 41516),
est = c(3899, 16486, 3123, 2511, 21298, 18592, 3325, 18293,
3191, 6282, 2045, 10887, 8096, 2300, 5898, 12163, 4592, 137077,
6329, 2658, 10395, 48893, 12642, 66489, 4109, 8488, 18098,
2614, 2193, 7953, 2587, 6401, 6530, 5994, 5045, 25544, 3938,
3438, 4006, 3305, 1936, 17296, 127170, 12073, 3539, 5676,
27190, 6381, 2855, 27251, 3153, 6803, 1909, 8681, 17459,
2764, 2953, 1960, 3006, 6472, 3048, 4900, 5343, 17916, 57660,
6043, 11213, 3139, 243420, 4663, 45916, 4328, 2133, 51551,
4513, 4744, 17221, 4649, 16921, 5663, 1821, 41361, 9490,
2111, 7243, 2005, 156111, 2545, 1426, 5127, 8883, 16576,
2951, 2461, 14380, 80560, 15629, 98561, 3402, 3323, 2762,
7071, 12362, 3368, 4274, 2494, 2932, 4866, 1806, 14208, 6163,
9696, 7583, 2459, 6725, 2721, 6046, 11416, 3527, 7737, 4197,
3221, 2361, 10291, 5818, 10377, 16350, 1980, 6285, 4100,
1942, 3346, 2174, 2703, 2570, 4404, 23939, 1907, 2433, 5830,
7673, 17428, 3523, 19162, 7132, 4993, 2317, 1585, 13478,
2972, 29338, 3294, 7370, 5629, 872, 2715, 2697, 4766, 135923,
6967, 9527, 3920, 45981, 3909, 2369, 2892, 13128, 2971, 36198,
2763, 3275, 3623, 3742, 3194, 2808, 3978, 4546, 6822, 2339,
52739, 5732, 6038, 6004, 4746, 17783, 1751, 3458, 13273,
4042, 4597, 3677, 11218, 12594, 9453, 5259, 3570, 43396,
2698, 2280, 2684, 1568, 2706, 12282, 2404, 8759, 17801, 3531,
5445, 2099, 357910, 29101, 7233, 5908, 5112, 1929, 16765,
10938, 2189, 2587, 2618, 11866, 6091, 25206, 2969, 188379,
2303, 2167, 5299, 37970, 94806, 4296, 8600, 8744, 4549, 2254,
7671, 2860, 1962, 3417, 2393, 3137, 10873, 4160, 11293, 41609,
2517, 19566, 30498, 572361, 3543, 21885, 5805, 6912, 3810,
3717, 13364, 35224, 6039, 23116, 60881, 3499, 2612, 20602,
13648, 4868, 2095, 9339, 8422, 145816, 92265, 1605, 59858,
3868, 1987, 17640, 66947, 10681, 5741, 40821, 12438, 3020,
3815, 4004, 31493, 4737, 8404, 4141, 11989, 31020, 70200,
8063, 5172, 24580, 7342, 2745, 1940, 46889, 4300, 5249, 4557,
2996, 75922, 9244, 8557, 10493, 31772, 2860, 44267, 81710,
127015, 48731, 8164, 6961, 4696, 11455, 13746, 8884, 13185,
101754, 4156, 1876, 2651, 2511, 9994, 2188, 4415, 7463, 6473,
6560, 13750, 5203, 13176, 11904, 2281, 3313, 2774, 11025,
1755, 15352, 8788, 74726, 3514, 3069, 1383, 13265, 5135,
9664, 20152, 24241, 4490, 5776, 21167, 6047, 3050, 6855,
2547, 2832, 37174, 6259, 5277, 1483, 3130, 149805, 4125,
2435, 3273, 2231, 3215, 3346, 14695, 3458, 2817, 8073, 3149,
13114, 19860, 4680, 8675, 12313, 2529, 2942)), .Names = c("cbsa_code",
"emp_app", "est"), row.names = c(13L, 16L, 45L, 53L, 63L, 85L,
97L, 117L, 132L, 136L, 163L, 178L, 195L, 199L, 214L, 232L, 255L,
257L, 278L, 287L, 301L, 316L, 341L, 346L, 363L, 389L, 401L, 411L,
428L, 440L, 462L, 468L, 491L, 510L, 511L, 527L, 541L, 564L, 573L,
592L, 610L, 622L, 641L, 660L, 667L, 676L, 692L, 713L, 726L, 739L,
759L, 777L, 788L, 798L, 823L, 833L, 851L, 861L, 884L, 891L, 912L,
926L, 944L, 955L, 963L, 985L, 993L, 1017L, 1031L, 1049L, 1065L,
1078L, 1086L, 1102L, 1125L, 1140L, 1153L, 1156L, 1171L, 1198L,
1208L, 1228L, 1231L, 1251L, 1268L, 1277L, 1305L, 1311L, 1332L,
1342L, 1357L, 1377L, 1385L, 1399L, 1415L, 1433L, 1448L, 1461L,
1485L, 1497L, 1515L, 1530L, 1533L, 1558L, 1564L, 1589L, 1603L,
1614L, 1632L, 1650L, 1655L, 1674L, 1686L, 1698L, 1717L, 1728L,
1747L, 1756L, 1779L, 1791L, 1811L, 1830L, 1845L, 1856L, 1866L,
1883L, 1902L, 1913L, 1926L, 1942L, 1963L, 1966L, 1989L, 2006L,
2014L, 2028L, 2043L, 2066L, 2077L, 2090L, 2103L, 2120L, 2132L,
2150L, 2161L, 2189L, 2204L, 2218L, 2231L, 2238L, 2257L, 2270L,
2286L, 2304L, 2316L, 2335L, 2344L, 2361L, 2376L, 2391L, 2406L,
2430L, 2432L, 2452L, 2465L, 2477L, 2491L, 2509L, 2535L, 2545L,
2564L, 2580L, 2588L, 2610L, 2625L, 2639L, 2654L, 2668L, 2685L,
2700L, 2705L, 2718L, 2731L, 2748L, 2771L, 2786L, 2798L, 2806L,
2826L, 2845L, 2859L, 2876L, 2890L, 2908L, 2924L, 2939L, 2943L,
2968L, 2973L, 2997L, 3003L, 3016L, 3033L, 3046L, 3066L, 3081L,
3105L, 3108L, 3125L, 3139L, 3153L, 3176L, 3187L, 3205L, 3213L,
3231L, 3245L, 3259L, 3276L, 3287L, 3315L, 3322L, 3331L, 3349L,
3369L, 3379L, 3396L, 3414L, 3427L, 3441L, 3463L, 3478L, 3494L,
3506L, 3511L, 3539L, 3551L, 3569L, 3585L, 3600L, 3606L, 3619L,
3643L, 3647L, 3667L, 3687L, 3694L, 3712L, 3723L, 3748L, 3755L,
3769L, 3784L, 3810L, 3820L, 3840L, 3843L, 3865L, 3881L, 3891L,
3915L, 3923L, 3936L, 3950L, 3970L, 3980L, 4003L, 4006L, 4033L,
4047L, 4062L, 4073L, 4088L, 4097L, 4120L, 4138L, 4149L, 4167L,
4180L, 4196L, 4210L, 4229L, 4238L, 4252L, 4261L, 4277L, 4305L,
4307L, 4322L, 4349L, 4351L, 4368L, 4394L, 4403L, 4412L, 4440L,
4447L, 4469L, 4475L, 4496L, 4511L, 4526L, 4537L, 4559L, 4571L,
4583L, 4595L, 4606L, 4626L, 4648L, 4658L, 4671L, 4691L, 4700L,
4713L, 4733L, 4755L, 4768L, 4780L, 4797L, 4811L, 4830L, 4833L,
4859L, 4861L, 4885L, 4897L, 4912L, 4931L, 4939L, 4952L, 4968L,
4985L, 5004L, 5012L, 5032L, 5047L, 5063L, 5076L, 5092L, 5112L,
5120L, 5140L, 5149L, 5175L, 5188L, 5193L, 5210L, 5230L, 5246L,
5261L, 5276L, 5285L, 5300L, 5311L, 5339L, 5346L, 5358L, 5380L,
5386L, 5410L, 5420L, 5443L, 5454L, 5470L, 5486L, 5494L, 5514L,
5531L, 5539L, 5552L, 5572L, 5591L, 5604L, 5625L, 5634L, 5641L,
5666L, 5671L, 5686L, 5713L), class = "data.frame")
cbsa_code
andemp_app
. What is theest
in the regression? $\endgroup$