如何在R中使用多个因序变量进行GEE回归

时间:2018-08-06 13:33:06

标签: r regression gee

我正在尝试使用R在下面的(样本)数据集上执行广义估计方程(GEE),我希望获得一些指导。首先,我将描述我的数据集。如下所示,它包含5个变量。 Country_ID从1到7(从最左边到最右边)显示了政治人物Ideo_Ordinal的国家。然后,我们对三个特征进行了测量。我想根据国家和每个政客的政治信念(因变量)与这三个特征进行分析。 GEE模型应隐藏国家/地区并取所有国家/地区的平均值,从而得出一个简单的回归模型,但要考虑到我们拥有不同的国家/地区。我使用geepack只是为了创建一个最小的可重现示例,但是我不确定这对于我的情况是最好的,因此我想对可以更好地处理多元回归的软件包提出建议和解决方案。

geepack版本

 library(geepack)

        samplem<-coef(summary(geeglm(sample$Ideo_Ordinal ~Machiavellianism+Psychopathy+Narcissism ,data = sample, id = sample$Country_ID,
                                       corstr = "independence"))) 

# multgee version

    library(multgee)
fitord <- ordLORgee(Ideo_Ordinal~ Machiavellianism+Psychopathy+Narcissism, data=RightWomen,
                    id= Politician_ID,repeated=Country_ID)
summary(fitord)
#sample dataset
Country_ID Ideo_Ordinal Machiavellianism   Narcissism  Psychopathy
3             1            3      0.250895132  0.155238716  0.128683755
5             1            3     -0.117725000 -0.336256435 -0.203137879
7             1            3      0.269509029 -0.260728261  0.086819555
9             1            6      0.108873496  0.175528190  0.182884928
14            1            3      0.173129951  0.054468468  0.155030794
15            1            6     -0.312088872 -0.414358301 -0.212599946
17            1            3     -0.297647658 -0.096523143 -0.228533352
18            1            3     -0.020389157 -0.210180866 -0.046687695
20            1            3     -0.523432382 -0.125114982 -0.431070629
21            1            1      0.040304508  0.022743463  0.233657881
22            1            3      0.253695988 -0.330825166  0.101122320
23            1            3     -0.478673895 -0.421801231 -0.422894791
27            1            6     -0.040856419 -0.566728704 -0.136069484
28            1            3      0.240040249 -0.398404825  0.135603114
29            1            6     -0.207631653 -0.005347621 -0.294935155
30            1            3      0.458042533  0.462935386  0.586244831
31            1            3     -0.259850232 -0.233074787 -0.092249465
33            1            3      0.002164223 -0.637668706 -0.267158031
34            1            6      0.050991955 -0.098030021 -0.043826848
36            1            3     -0.338052871 -0.168894328 -0.230198200
38            1            3      0.174382347  0.023807812  0.192963609
41            2            3     -0.227322148 -0.010016330 -0.095576329
42            2            3     -0.267514920  0.066108837 -0.218979873
43            2            3      0.421277754  0.385223920  0.421274111
44            2            3     -0.399592341 -0.498154998 -0.320402699
45            2            1      0.162038344  0.328116118  0.104105963
47            2            3     -0.080755709  0.003080287 -0.043568723
48            2            3      0.059474124 -0.447305420  0.003988071
49            2            3     -0.219773040 -0.312902659 -0.239057883
51            2            3      0.438659431  0.364042111  0.393014172
52            2            3     -0.088560903 -0.490889275 -0.006041054
53            2            3     -0.122612591  0.074438944  0.103722836
54            2            3     -0.450586055 -0.304253061 -0.132365179
55            2            6     -0.710545197 -0.451329850 -0.764201786
56            2            3      0.330718447  0.335460128  0.429173481
57            2            3      0.442508023  0.297522144  0.407155726
60            2            3      0.060797815 -0.096516876 -0.012802977
61            2            3     -0.250757764 -0.113219864 -0.215345379
62            2            1      0.153654345 -0.089615287  0.118626045
65            2            3      0.042969508 -0.486999608 -0.080829636
66            3            3      0.158337022  0.208229002  0.241607154
67            3            3      0.220237408  0.397914524  0.262207709
69            3            3      0.200558577  0.244419633  0.301732113
71            3            3      0.690244689  0.772692418  0.625921098
72            3            3      0.189810070  0.377774321  0.293988340
73            3            3     -0.385724422 -0.262131032 -0.373159652
74            3            3     -0.124095769 -0.109816334 -0.127157915
75            3            1      0.173299879  0.453592671  0.325357383
76            3            3     -0.598215129 -0.643286651 -0.423824759
77            3            3     -0.420558406 -0.361763025 -0.465612116
78            3            3     -0.176788569 -0.305506924 -0.203730879
80            3            3     -0.114790731  0.262392918  0.061382073
81            3            3     -0.274904173 -0.342603918 -0.302761994
82            3            3     -0.146902101 -0.059558818 -0.120550957
84            3            3      0.038303792 -0.139833875  0.170005914
85            3            3     -0.220212221 -0.541399757 -0.555201764
87            3            3      0.255300386  0.179484246  0.421428096
88            3            6     -0.548823069 -0.405541620 -0.322935805

0 个答案:

没有答案