r - 看似不相关的回归的 T 检验
问题描述
如果使用 t 检验的系数相等,我想比较两个回归,我怎么能接近这个,R 中是否有一个函数,它对看似不相关的回归执行此操作?linearhypothesis 函数仅支持卡方检验和 f 检验。
structure(list(Mkt.RF = c(-3.58, -2.06, 2.13, 4.26, 3.45, -0.74,
0.66, -5.11, -5.98, -4.32, 2.3, -3.91, 4.66, -1.52, 3.27, 3.09,
2.31, 2.93, 4.39, 1.91), SMB = c(3.4, -0.72, 0.27, -1.6, -1.07,
0.55, -0.76, 0.06, 0.08, -2.52, 0.4, -0.93, 4.36, 0.7, 0.63,
-0.59, 2.24, -0.24, 0.47, 1.19), HML = c(2.78, -0.73, -0.47,
-1.51, -2.05, 0.01, 0.38, -0.45, 0.88, -1.83, -2.9, -1.71, 4.23,
0.28, -0.92, 1.46, -0.35, 0.5, 3.12, 0.29), RF = c(0.27, 0.24,
0.23, 0.25, 0.26, 0.24, 0.3, 0.25, 0.26, 0.29, 0.28, 0.24, 0.28,
0.12, 0.09, 0.08, 0.11, 0.03, 0.07, 0.04), Mom = c(-3.05, 0.31,
-0.18, 0.96, 0.44, 0.77, -0.07, 0.49, 0.62, 1.94, 1.24, 7.79,
-7.63, 3.75, -1.85, 1.85, -1.82, -0.87, -3.62, 0.28), ST_Rev = c(3.64,
-0.12, 1.08, -0.54, 0.2, -0.83, 0.59, 0.38, -4.04, -3.54, -0.16,
-1.2, 5.46, 1.79, 1.15, -0.44, 1.19, 1.96, 2.7, 1.71), LT_Rev = c(4.96,
1.11, -0.63, -1.9, -2.06, -1.56, -0.56, 2.1, 2.47, -0.14, -0.82,
1.66, 2.5, 0.82, -0.69, 1.13, 0.29, -0.68, -2.12, 0.65), SMALL.LoBM = c(-0.2503,
2.9079, -2.7574, 0.0526, 6.5715, -2.9304, 10.823, -3.7417, -8.4998,
-9.134, 2.3031, -10.7934, 22.6559, -8.0991, 0.0122, 3.9872, 8.0196,
2.8676, 0.9155, 3.6121), ME1.BM2 = c(1.1499, -2.684, 0.4626,
0.712, -0.3634, 1.7096, -3.2747, -3.2251, -2.4005, -10.0789,
-2.5086, -5.2028, 9.4805, 0.5592, 5.8376, 5.6991, 4.7564, 1.8046,
7.0892, -0.4536), ME1.BM3 = c(0.3391, -2.9947, 3.0314, 2.66,
-2.005, -0.6318, 0.0214, -3.7985, -4.0396, -6.2716, 0.7112, -4.4564,
9.2809, -1.7363, 4.1581, 2.3189, 4.1872, 1.2225, 7.3031, 3.1771
), ME1.BM4 = c(2.3947, -2.7768, 2.5032, 1.8131, 0.6916, 1.0397,
-0.0338, -4.9373, -4.2979, -6.7299, 0.7121, -6.0009, 11.4808,
-1.4308, 4.6421, 3.3693, 3.8889, 3.225, 6.2092, 2.8972), SMALL.HiBM = c(3.0661,
-1.9227, 0.616, 2.8892, -0.1074, 1.5065, -0.1177, -4.2014, -4.7744,
-9.7825, 1.1377, -5.4893, 14.1829, -0.9943, 2.7984, 3.6832, 3.9037,
3.247, 5.5628, 4.5524), ME2.BM1 = c(1.7551, -5.7328, 2.3007,
2.2013, 3.297, -0.3559, -1.8405, -4.774, -6.8747, -6.8879, 1.458,
-5.9069, 12.2022, 0.5558, 8.1202, 4.8782, 4.2682, 0.2252, 2.1459,
3.9586), ME2.BM2 = c(-0.9705, -1.8677, 0.7317, -1.0295, 4.1267,
-0.7306, 0.2541, -3.6977, -4.6924, -6.7164, 2.2514, -3.128, 10.4595,
-0.0779, 2.3431, 3.8102, 3.3286, 4.95, 2.744, 3.2929), ME2.BM3 = c(1.4035,
-3.6199, 1.6266, 3.6103, 0.4984, -0.5925, 0.3072, -4.2721, -3.8077,
-5.3892, 1.0828, -1.5308, 8.6883, -0.6165, 3.1584, 2.746, 2.757,
2.2907, 5.4909, 2.0368), ME2.BM4 = c(-0.2011, -3.6209, 1.9333,
0.8332, 0.5706, -2.2377, 0.8313, -5.3742, -4.3962, -6.4608, -1.6069,
-7.2318, 10.738, -0.1293, 2.7462, 2.1808, 3.6956, 3.4065, 5.033,
2.1134), ME2.BM5 = c(2.0711, -1.8232, 2.8456, 4.0999, 2.7381,
1.3955, 0.405, -6.2742, -7.0585, -9.4413, 0.3334, -7.2297, 12.7326,
0.3038, 3.561, 4.8341, 5.7237, 2.9956, 7.3176, 4.6113), ME3.BM1 = c(-0.1804,
-2.8882, 1.352, 2.9007, 2.782, 1.1381, 0.4867, -6.2306, -5.7554,
-7.6683, 3.8579, -4.5266, 7.913, -0.4997, 3.1115, 2.7842, 6.7293,
2.9003, 2.5795, 4.0556), ME3.BM2 = c(-0.7311, -2.9647, 3.2335,
1.3674, 1.6556, -2.206, -0.6753, -4.4656, -7.6589, -5.5316, 3.1475,
-2.6196, 8.4187, -0.1565, 4.58, 0.798, 4.7252, 2.4181, 5.6894,
3.4092), ME3.BM3 = c(-1.4191, -2.7309, 2.89, 3.2702, 3.0169,
-2.3016, -0.3286, -5.2077, -4.643, -5.6728, 2.0126, -5.0963,
10.1059, -0.6968, 3.0432, 1.7961, 3.8527, 2.8335, 6.8058, 3.3262
), ME3.BM4 = c(-0.5254, -2.7913, 1.6405, 1.4421, 1.5075, -0.5878,
1.1964, -5.8299, -5.3617, -6.2945, 1.7535, -7.0812, 12.6428,
-0.7669, 3.2638, 0.8487, 4.3544, 1.708, 7.1502, 4.1152), ME3.BM5 = c(1.4049,
-3.8607, 1.5727, 0.7456, 1.9912, -1.1459, 0.8075, -6.2397, -4.5381,
-7.5731, 3.4239, -4.1991, 10.9095, 0.1019, 4.1297, 4.7065, 4.3938,
3.4303, 10.057, 1.8304), ME4.BM1 = c(-1.7133, -1.0446, 2.7137,
4.259, 2.8387, -1.6461, -0.2418, -7.7127, -5.2005, -6.3393, 3.8992,
-3.7172, 6.9502, -1.4509, 5.7128, 3.7283, 2.5366, 3.3355, 3.7266,
3.213), ME4.BM2 = c(-1.2759, -1.3582, 1.2222, 1.8649, 1.9799,
-2.6201, -0.2497, -5.8088, -5.3128, -2.6377, 3.6378, -2.8932,
7.9308, -0.6119, 2.7065, 2.58, 2.3185, 1.9882, 3.9238, 1.8505
), ME4.BM3 = c(-1.216, -2.5053, 3.1187, 2.4602, 0.4411, -2.2538,
-0.0837, -4.3101, -3.3985, -3.3454, 1.5862, -0.8756, 7.309, 0.7886,
3.2176, 2.0817, 2.7693, 2.8197, 5.6228, 3.8941), ME4.BM4 = c(-2.2442,
-3.8999, 2.0182, 3.5898, 1.2033, -2.6227, 1.0005, -5.9218, -7.1044,
-7.2683, 1.3216, -7.3886, 13.209, -1.8963, 1.8581, 3.2885, 3.0029,
3.0511, 5.3104, 1.8811), ME4.BM5 = c(-1.9603, -2.9296, 1.4486,
0.1516, 3.6732, 0.0404, 1.0588, -5.8241, -8.7229, -10.6485, -0.906,
-5.8981, 13.5529, -2.6018, 3.0886, 6.0737, 2.1082, 4.763, 9.537,
3.8238), BIG.LoBM = c(-5.1549, -1.8637, 2.3957, 5.3741, 4.8306,
0.1678, 1.2408, -5.6726, -7.1147, -3.9227, 2.5652, -3.8819, 2.6308,
-2.0986, 3.1063, 2.9589, 1.7297, 2.9227, 5.0309, 1.7733), ME5.BM2 = c(-4.7384,
-1.4001, 1.9731, 5.4208, 2.9949, -2.0476, 0.8084, -4.9762, -5.2956,
-3.702, 2.7913, -4.5086, 3.4779, -1.3382, 3.1628, 3.3917, 2.6598,
3.2409, 2.1203, 0.6962), ME5.BM3 = c(-2.3125, -1.9445, 2.0115,
2.8931, 2.7253, -0.7017, -0.2, -2.5243, -4.2654, -3.6365, 1.4897,
-1.76, 5.0131, -0.8321, 3.7127, 3.1274, 1.792, 2.9392, 3.729,
2.1507), ME5.BM4 = c(-4.6173, -4.2998, 0.8601, 4.602, 2.0774,
-2.303, 0.7922, -5.4849, -5.6303, -5.7929, 1.7485, -7.3657, 6.9289,
-3.2758, 2.9054, 2.5705, 3.3908, 2.7507, 5.463, 1.784), BIG.HiBM = c(-0.9533,
-4.2776, 1.9959, 1.6504, 2.5779, 0.0725, 0.9071, -5.1901, -8.6878,
-7.8173, -4.4356, -7.0048, 11.5797, -3.4114, 1.2488, 6.2048,
3.9438, 3.1976, 7.7579, 2.0333)), row.names = c(NA, 20L), class = "data.frame")
*编辑:我现在添加了数据框
解决方案
我正在使用这篇文章的信息:https ://stats.stackexchange.com/questions/93540/testing-equality-of-coefficients-from-two-different-regressions
我创建了两个任意方程:
eq1 = ME1.BM2 ~ Mkt.RF + SMB
eq2 = ME1.BM3 ~ Mkt.RF + HML
mod = summary(systemfit::systemfit(list(eq1, eq2), data=df))
现在我们计算该帖子中提供的 Z 统计量:
为此,我们mod
手动检索并计算它的系数:
coef1 = mod$eq[[1]]$coefficients[3,] #The 3 is for getting the HML coef
coef2 = mod$eq[[2]]$coefficients[3,] #The 3 is for getting the SMB coef
Z = (coef1[1]-coef2[1])/sqrt(coef1[2]^2-coef2[2]^2) #[2] is the estimate, [2] is the sd
然后,您可以将Z
所需的显着性值与标准正态分布的临界值进行比较。
我找不到执行此测试的包,但我认为这是正确的。
推荐阅读
- c - 试图通过 Suckless 的 slstatus 找出一些 C 代码
- java - 如何在java/nodejs的rest api中使用jbpm服务任务的authtype用户名密码参数
- postgresql - 如何在 Qlik Sense 仪表板中显示来自 Postgres 的 jpeg 图像
- mysql - MySQL 时区、现在时间和工作台执行脚本的时间都不同
- javascript - 如何在 eslint 中使用与项目相关的导入?
- sql-server - SSIS 包卡在“等待执行”状态
- html - Jinja2 中使用 range(len()) 的数组中的表
- c# - 从不同的类 c#ranorex 访问绑定变量
- dll - Roslaunch 无法打开共享对象文件:没有这样的文件或目录
- python - 如何将项目附加到二维列表中?