我能够运行以下模型:
> mod1b <- lrm(dependent_variable ~ quarterYear.x, data = merged_dataset)
> print(mod1b)
Logistic Regression Model
lrm(formula = dependent_variable ~ quarterYear.x, data = merged_dataset)
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 28198 LR chi2 3466.57 R2 0.181 C 0.714
0 22333 d.f. 38 g 0.792 Dxy 0.428
1 5865 Pr(> chi2) <0.0001 gr 2.207 gamma 0.438
max |deriv| 5e-13 gp 0.141 tau-a 0.141
Brier 0.141
Coef S.E. Wald Z Pr(>|Z|)
Intercept -1.6422 0.1410 -11.64 <0.0001
quarterYear.x=2008 3 -0.0846 0.1980 -0.43 0.6691
quarterYear.x=2008 4 0.0553 0.1864 0.30 0.7669
quarterYear.x=2009 1 0.1120 0.2210 0.51 0.6122
quarterYear.x=2009 2 0.2401 0.2154 1.11 0.2650
quarterYear.x=2009 3 0.3360 0.2106 1.60 0.1106
quarterYear.x=2009 4 0.4365 0.2076 2.10 0.0355
quarterYear.x=2010 1 1.9436 0.1692 11.49 <0.0001
quarterYear.x=2010 2 2.0445 0.1673 12.22 <0.0001
quarterYear.x=2010 3 1.8433 0.1688 10.92 <0.0001
quarterYear.x=2010 4 1.9154 0.1620 11.82 <0.0001
quarterYear.x=2011 1 2.0954 0.1741 12.04 <0.0001
quarterYear.x=2011 2 1.8132 0.1664 10.89 <0.0001
quarterYear.x=2011 3 1.6494 0.1644 10.03 <0.0001
quarterYear.x=2011 4 1.7140 0.1669 10.27 <0.0001
quarterYear.x=2012 1 0.9454 0.1756 5.38 <0.0001
quarterYear.x=2012 2 0.7768 0.1749 4.44 <0.0001
quarterYear.x=2012 3 0.9222 0.1732 5.32 <0.0001
quarterYear.x=2012 4 0.7500 0.1784 4.20 <0.0001
quarterYear.x=2013 1 -0.1136 0.1835 -0.62 0.5360
quarterYear.x=2013 2 -0.0625 0.1817 -0.34 0.7308
quarterYear.x=2013 3 -0.0304 0.1811 -0.17 0.8667
quarterYear.x=2013 4 0.5335 0.1602 3.33 0.0009
quarterYear.x=2014 1 -0.0936 0.1680 -0.56 0.5774
quarterYear.x=2014 2 -0.0243 0.1679 -0.14 0.8850
quarterYear.x=2014 3 -0.0980 0.1689 -0.58 0.5619
quarterYear.x=2014 4 -0.1459 0.1684 -0.87 0.3862
quarterYear.x=2015 1 -0.2017 0.1678 -1.20 0.2294
quarterYear.x=2015 2 -0.4631 0.1712 -2.70 0.0068
quarterYear.x=2015 3 -0.3057 0.1675 -1.83 0.0680
quarterYear.x=2015 4 -0.3076 0.1666 -1.85 0.0649
quarterYear.x=2016 1 -0.1623 0.1638 -0.99 0.3216
quarterYear.x=2016 2 -0.3689 0.1670 -2.21 0.0271
quarterYear.x=2016 3 -0.7155 0.1744 -4.10 <0.0001
quarterYear.x=2016 4 -0.4090 0.1681 -2.43 0.0150
quarterYear.x=2017 1 -0.3493 0.1657 -2.11 0.0351
quarterYear.x=2017 2 -0.5273 0.1704 -3.10 0.0020
quarterYear.x=2017 3 -0.4696 0.1683 -2.79 0.0053
quarterYear.x=2017 4 -0.3828 0.1735 -2.21 0.0273
和
> mod1b <- lrm(dependent_variable ~ var1 + var2 + var3 + var4 + var5 + var6 + var7 + var8, data = merged_dataset)
> print(mod1b)
Logistic Regression Model
lrm(formula = dependent_variable ~ var1 + var2 + var3 + var4 + var5 + var6 + var7 + var8, data = merged_dataset)
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 28198 LR chi2 2431.49 R2 0.129 C 0.706
0 22333 d.f. 11 g 0.833 Dxy 0.412
1 5865 Pr(> chi2) <0.0001 gr 2.300 gamma 0.412
max |deriv| 0.001 gp 0.132 tau-a 0.136
Brier 0.150
Coef S.E. Wald Z Pr(>|Z|)
Intercept -1.4032 0.2504 -5.60 <0.0001
var1 3.3649 0.0866 38.84 <0.0001
var2=EUR 0.0620 0.2449 0.25 0.8000
var2=GBP -5.1954 28.7069 -0.18 0.8564
var2=JPY -0.3392 0.4959 -0.68 0.4939
var2=USD -0.6195 0.2634 -2.35 0.0187
var3 -0.2103 0.0387 -5.44 <0.0001
var4 0.1288 0.0275 4.68 <0.0001
var5 -0.0812 0.0202 -4.02 <0.0001
var6 -6.7443 0.3803 -17.73 <0.0001
var7 1.5258 0.2817 5.42 <0.0001
var8 -0.1011 0.0173 -5.84 <0.0001
但是下面的一个是前两个的组合给我一个错误:
> mod1b <- lrm(dependent_variable ~ var1 + var2 + var3 + var4 + var5 + var6 + var7 + var8 + quarterYear.x, data = merged_dataset, na.action="na.delete")
singular information matrix in lrm.fit (rank= 49 ). Offending variable(s):
quarterYear.x=2017 4
Warning message:
In lrm(dependent_variable ~ var1 + var2 + var3 + :
Unable to fit model using “lrm.fit”
> print(mod1b)
Error in 1:ns : argument of length 0
您知道为什么会发生这种情况以及如何解决此问题吗?