library("gdata")
## gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
##
## gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
##
## Attaching package: 'gdata'
## The following object is masked from 'package:stats':
##
## nobs
## The following object is masked from 'package:utils':
##
## object.size
au = read.xls("/Users/ferarevalo1/Documents/Econometria 1 /Automovil .xlsx")
au
## A.o. precio ingreso Stock. ventas
## 1 1932 126.5 83.4 18.7 1.10
## 2 1933 128.5 82.6 17.9 1.53
## 3 1934 128.5 90.9 18.9 1.93
## 4 1935 120.5 99.3 19.4 2.87
## 5 1936 117.0 111.6 20.1 3.51
## 6 1937 121.0 115.6 21.5 3.51
## 7 1938 133.8 109.0 22.3 1.96
## 8 1939 131.0 118.5 22.7 2.72
## 9 1940 134.3 127.0 23.2 3.46
## 10 1941 144.9 147.9 24.5 3.76
## 11 1949 186.6 184.9 30.6 4.87
## 12 1950 186.6 200.5 33.1 6.37
## 13 1951 181.5 203.7 35.7 5.09
## 14 1952 195.7 209.2 37.6 4.19
## 15 1953 188.2 218.7 39.3 5.78
## 16 1954 190.2 221.6 41.6 5.47
## 17 1955 196.6 236.3 43.0 7.20
## 18 1956 193.4 247.2 47.0 5.90
au$lnventas = log(au$ventas)
au$lnprecio = log(au$precio)
au$lningresos = log(au$ingreso)
au$lnstock = log(au$Stock.)
reg = lm(formula = au$lnventas ~ au$lnprecio+au$lningresos, data = au)
summary(reg)
##
## Call:
## lm(formula = au$lnventas ~ au$lnprecio + au$lningresos, data = au)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.27977 -0.09603 0.01293 0.11487 0.27186
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.1536 1.5240 0.101 0.92103
## au$lnprecio -2.0327 0.5683 -3.577 0.00275 **
## au$lningresos 2.2742 0.3031 7.502 1.88e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1624 on 15 degrees of freedom
## Multiple R-squared: 0.9159, Adjusted R-squared: 0.9047
## F-statistic: 81.69 on 2 and 15 DF, p-value: 8.619e-09
reg2 = lm(formula = au$lnventas ~ au$lnprecio+au$lningresos+au$lnstock)
summary(reg2)
##
## Call:
## lm(formula = au$lnventas ~ au$lnprecio + au$lningresos + au$lnstock)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.21694 -0.07982 0.01759 0.10602 0.19165
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.7207 1.7324 -1.570 0.1386
## au$lnprecio -1.4220 0.5440 -2.614 0.0204 *
## au$lningresos 3.2159 0.4543 7.079 5.51e-06 ***
## au$lnstock -1.4789 0.5850 -2.528 0.0241 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1393 on 14 degrees of freedom
## Multiple R-squared: 0.9423, Adjusted R-squared: 0.9299
## F-statistic: 76.17 on 3 and 14 DF, p-value: 6.545e-09
La segunda regresion es la que tiene mayor nivel de significancia.
Si la X incrementa en 1% las ventas disminuiran en 1.48%. Si tiene sentido por que el consumidor ya tiene su demanda casi completa.
ci = read.xls("/Users/ferarevalo1/Documents/Econometria 1 /CasoI.xlsx")
ci$lnx = log(ci$X1940)
reg3 = lm(formula = ci$Promedio ~ ci$lnx)
summary(reg3)
##
## Call:
## lm(formula = ci$Promedio ~ ci$lnx)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5154.4 -1782.9 -964.9 1328.2 11026.8
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -62187.1 8519.3 -7.300 3.96e-08 ***
## ci$lnx 8618.2 978.6 8.806 8.10e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3433 on 30 degrees of freedom
## Multiple R-squared: 0.7211, Adjusted R-squared: 0.7118
## F-statistic: 77.55 on 1 and 30 DF, p-value: 8.095e-10
Si hay convergencia por las variables.