[R] Variance Inflation Factor VIC() with a matrix
Martin H. Schmidt
martin.h.schmidt at wiwi.hu-berlin.de
Thu Sep 20 14:52:22 CEST 2012
Hi everyone,
Running the vif() function from the car package like
----------------------------------------------------
> reg2 <- lm(CARsPur~Delay_max10+LawChange+MarketTrend_20d+MultiTrade,
data=data.frame(VarVecPur))
> vif(reg2)
Delay_max10 LawChange MarketTrend_20d MultiTrade
1.010572 1.009874 1.004278 1.003351
----------------------------------------------------
gives a useful result. But using the right-hand variables as a matrix in
the following way doesn't work with the vif() function:
----------------------------------------------------
> reg <- lm(CARsPur~VarVecPur)
> summary(reg)
Call:
lm(formula = CARsPur ~ VarVecPur)
Residuals:
Min 1Q Median 3Q Max
-0.72885 -0.06461 0.00493 0.06873 0.74936
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.037860 0.006175 -6.131 9.25e-10 ***
VarVecPurDelay_max10 0.003661 0.001593 2.298 0.0216 *
VarVecPurLawChange 0.004679 0.006185 0.757 0.4493
VarVecPurMarketTrend_20d 0.019015 0.001409 13.493 < 2e-16 ***
VarVecPurMultiTrade -0.005081 0.003129 -1.624 0.1045
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.1229 on 6272 degrees of freedom
Multiple R-squared: 0.03021, Adjusted R-squared: 0.02959
F-statistic: 48.84 on 4 and 6272 DF, p-value: < 2.2e-16
> vif(reg)
Error in vif.lm(reg) : model contains fewer than 2 terms
----------------------------------------------------
Is there a solution or a way to work around?
Thank you very much in advanced.
--
Kind Regards,
Martin H. Schmidt
Humboldt University Berlin
More information about the R-help
mailing list