- https://i.stack.imgur.com/uYayd.gif
-
https://i.stack.imgur.com/bAEMc.gif
tail -c +43 uYayd.gif > TROW.tsv tail -c +43 bAEMc.gif > AABB.tsv
Utilizando los dos archivos anteriores, puedo ejecutar modelos lineales con ellos.
Lo siguiente parece indicar que tanto ema21diff como ema89diff pueden utilizarse muy bien para el ajuste.
R> summary(lm(futrdiff ~ ema21diff, data=TROW))
Call:
lm(formula = futrdiff ~ ema21diff, data = TROW)
Residuals:
Min 1Q Median 3Q Max
-6.9238 -1.4405 0.0598 1.8670 8.0834
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.32199 0.38956 3.394 0.000899 ***
ema21diff -0.66179 0.08244 -8.027 3.77e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.479 on 139 degrees of freedom
Multiple R-squared: 0.3167, Adjusted R-squared: 0.3118
F-statistic: 64.44 on 1 and 139 DF, p-value: 3.774e-13
R> summary(lm(futrdiff ~ ema89diff, data=TROW))
Call:
lm(formula = futrdiff ~ ema89diff, data = TROW)
Residuals:
Min 1Q Median 3Q Max
-5.5066 -1.7942 -0.0663 1.6676 7.6233
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.72792 0.93537 7.193 3.58e-11 ***
ema89diff -0.52376 0.05945 -8.811 4.52e-15 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.402 on 139 degrees of freedom
Multiple R-squared: 0.3583, Adjusted R-squared: 0.3537
F-statistic: 77.63 on 1 and 139 DF, p-value: 4.515e-15
R> summary(lm(futrdiff ~ ema21diff + ema89diff, data=TROW))
Call:
lm(formula = futrdiff ~ ema21diff + ema89diff, data = TROW)
Residuals:
Min 1Q Median 3Q Max
-5.7963 -1.7125 0.0304 1.7103 7.6391
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.4699 1.3091 4.178 5.18e-05 ***
ema21diff -0.2148 0.1569 -1.369 0.1732
ema89diff -0.3861 0.1167 -3.308 0.0012 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.395 on 138 degrees of freedom
Multiple R-squared: 0.3669, Adjusted R-squared: 0.3578
F-statistic: 39.99 on 2 and 138 DF, p-value: 1.993e-14
Lo siguiente parece indicar que sólo importa ema89diff, pero no ema21diff.
R> summary(lm(futrdiff ~ ema21diff, data=AABB))
Call:
lm(formula = futrdiff ~ ema21diff, data = AABB)
Residuals:
Min 1Q Median 3Q Max
-6.6453 -1.0660 0.1424 1.5878 3.7737
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.82788 0.18510 -4.473 1.59e-05 ***
ema21diff -0.29036 0.08208 -3.537 0.00055 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.021 on 139 degrees of freedom
Multiple R-squared: 0.08258, Adjusted R-squared: 0.07598
F-statistic: 12.51 on 1 and 139 DF, p-value: 0.00055
R> summary(lm(futrdiff ~ ema89diff, data=AABB))
Call:
lm(formula = futrdiff ~ ema89diff, data = AABB)
Residuals:
Min 1Q Median 3Q Max
-5.6130 -1.0894 0.1935 1.4290 4.4952
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.32680 0.32840 0.995 0.321
ema89diff -0.29094 0.05865 -4.961 2.02e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.945 on 139 degrees of freedom
Multiple R-squared: 0.1504, Adjusted R-squared: 0.1443
F-statistic: 24.61 on 1 and 139 DF, p-value: 2.018e-06
R> summary(lm(futrdiff ~ ema21diff+ema89diff, data=AABB))
Call:
lm(formula = futrdiff ~ ema21diff + ema89diff, data = AABB)
Residuals:
Min 1Q Median 3Q Max
-5.578 -1.140 0.206 1.361 4.593
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.6154 0.4542 1.355 0.177682
ema21diff 0.1345 0.1462 0.920 0.359045
ema89diff -0.3750 0.1086 -3.454 0.000733 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.946 on 138 degrees of freedom
Multiple R-squared: 0.1556, Adjusted R-squared: 0.1434
F-statistic: 12.71 on 2 and 138 DF, p-value: 8.547e-06
Es trivial examinar manualmente la selección de modelos de este modo. ¿Podría alguien mostrarme una forma automatizada y de uso común para detectar los mejores modelos lineales (posiblemente los mejores modelos casi equivalentes) para un ajuste?