puntos) ¿Qué factores afectan a que un jugador anote x goles en una temporada? ⢠Posición - > Delantero, Medio, Defensa, Portero ⢠Edad -> Años de vida del jugador ⢠Carrera -> Años de carrera ⢠Tiempo de Juego -> Minutos Jugados ⢠Salario -> Salario Anual
Goles=f( posición, edad, carrera, tiempo de juego, equipo )
Goles= B0+ B1* posición + B2Edad + B3 Carrera + B4Tiempo de Juego + B5Salario+ u
Sebastian Romano Mena RaĆŗl CantĆŗ 12/02/2024
La Importancia de los Diferentes Tipos de Datos en Investigaciones Económicas En el Ć”mbito de la investigación económica, el uso de diversos tipos de datos es fundamental para entender las dinĆ”micas y tendencias de los mercados, las economĆas y el comportamiento social. Los datos de corte transversal, de serie de tiempo y de panel son herramientas esenciales en este anĆ”lisis, cada uno con sus ventajas y aplicaciones especĆficas. Los datos de corte transversal se refieren a datos recopilados en un solo punto en el tiempo, pero de mĆŗltiples sujetos, regiones o entidades. Estos datos son cruciales para comparar y contrastar diferentes grupos o situaciones en un momento especĆfico, permitiendo a los investigadores identificar patrones o discrepancias. Por ejemplo, un estudio que analiza el ingreso per cĆ”pita en diferentes paĆses para un aƱo dado utiliza datos de corte transversal para ofrecer una instantĆ”nea de la distribución económica global (Smith, 2020). Por otro lado, los datos de serie de tiempo se concentran en observar y registrar datos de una sola entidad a lo largo de varios puntos en el tiempo. Esto es particularmente Ćŗtil para analizar tendencias, ciclos y otros fenómenos que se desarrollan a lo largo del tiempo. Un economista que estudia la inflación anual de un paĆs durante las Ćŗltimas dĆ©cadas se basa en datos de serie de tiempo para entender las fluctuaciones y predecir tendencias futuras (Johnson, 2021). Finalmente, los datos de panel o longitudinales combinan las dimensiones de los datos de corte transversal y de serie de tiempo, rastreando mĆŗltiples sujetos a lo largo del tiempo. Este tipo de datos permite a los investigadores no solo identificar patrones temporales y entre grupos, sino tambiĆ©n observar cómo las variables interactĆŗan y cambian con el tiempo en el mismo sujeto o entidad. Los datos de panel son especialmente valorados en estudios longitudinales que buscan entender el impacto de polĆticas o cambios económicos en diferentes poblaciones (Davis, 2022). En conclusión, la elección del tipo de datos a utilizar en la investigación económica depende del objetivo del estudio, la naturaleza de la hipótesis y las preguntas de investigación. La capacidad de combinar y analizar estos diferentes tipos de datos ofrece una comprensión mĆ”s rica y matizada de los fenómenos económicos, lo que resulta esencial para formular polĆticas efectivas y para avanzar en el conocimiento económico.
Obras Citadas Davis, Laura. āUnderstanding Economic Impacts through Panel Data Analysis.ā Journal of Economic Studies, vol.Ā 48, no. 3, 2022, pp.Ā 645-662. Johnson, Mark. āTrends in Inflation: A Time Series Analysis.ā Economic Insights, vol.Ā 37, no. 2, 2021, pp.Ā 200-215. Smith, Anna. āGlobal Economic Distribution: A Cross-Sectional Study.ā World Economy Review, vol.Ā 55, no. 1, 2020, pp.Ā 30-45.
#install.packages('WDI')
#install.packages('wbstats')
#install.packages('tidyverse')
#install.packages('gplots')
library(WDI)
library(wbstats)
library(tidyverse)
## āā Attaching core tidyverse packages āāāāāāāāāāāāāāāāāāāāāāāā tidyverse 2.0.0 āā
## ā dplyr 1.1.4 ā readr 2.1.5
## ā forcats 1.0.0 ā stringr 1.5.1
## ā ggplot2 3.4.4 ā tibble 3.2.1
## ā lubridate 1.9.3 ā tidyr 1.3.1
## ā purrr 1.0.2
## āā Conflicts āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā tidyverse_conflicts() āā
## ā dplyr::filter() masks stats::filter()
## ā dplyr::lag() masks stats::lag()
## ā¹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(gplots)
##
## Attaching package: 'gplots'
##
## The following object is masked from 'package:stats':
##
## lowess
#install.packages('plm')
library(plm)
##
## Attaching package: 'plm'
##
## The following objects are masked from 'package:dplyr':
##
## between, lag, lead
# obtener informacion de varios paises
gdp_data <- wb_data(country=c('MX','CA','EC'), indicator ='NY.GDP.PCAP.CD', start_date = 2013, end_date =2023 )
gdp_data
## # A tibble: 30 Ć 9
## iso2c iso3c country date NY.GDP.PCAP.CD unit obs_status footnote
## <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
## 1 CA CAN Canada 2013 52635. <NA> <NA> <NA>
## 2 CA CAN Canada 2014 50956. <NA> <NA> <NA>
## 3 CA CAN Canada 2015 43596. <NA> <NA> <NA>
## 4 CA CAN Canada 2016 42316. <NA> <NA> <NA>
## 5 CA CAN Canada 2017 45129. <NA> <NA> <NA>
## 6 CA CAN Canada 2018 46549. <NA> <NA> <NA>
## 7 CA CAN Canada 2019 46374. <NA> <NA> <NA>
## 8 CA CAN Canada 2020 43562. <NA> <NA> <NA>
## 9 CA CAN Canada 2021 52515. <NA> <NA> <NA>
## 10 CA CAN Canada 2022 55522. <NA> <NA> <NA>
## # ā¹ 20 more rows
## # ā¹ 1 more variable: last_updated <date>
panel <- select(gdp_data,country,date,NY.GDP.PCAP.CD)
bd<-wb_data(country = c("AR","US","MX","CN"), indicator = c("NY.GDP.MKTP.KD.ZG","SL.UEM.TOTL.ZS",
"AG.LND.AGRI.ZS", "AG.LND.ARBL.ZS", "EG.ELC.ACCS.ZS", "SP.POP.GROW", "GB.XPD.RSDV.GD.ZS"), start_date=1950, end_date=2023)
panel<-subset(bd,date==2000 | date==2010 | date==2015 | date==2020)
grafica1 <-plotmeans(panel$NY.GDP.MKTP.KD.ZG ~ panel$date,
mean.labels=TRUE, digits=-3,
col="red", connect=FALSE)
grafica1
## NULL
grafica2 <- plotmeans(bd$NY.GDP.MKTP.KD.ZG ~ bd$country,
mean.labels=TRUE, digits=-3,
col="red", connect=FALSE)
grafica2
## NULL
Pregunta 1:
La lĆnea que conecta los promedios entre paĆses muestra fluctuaciones moderadas, manteniĆ©ndose relativamente estable a lo largo de los aƱos hasta llegar al 2020, donde se observan variaciones mĆ”s pronunciadas. Este cambio sugiere una alteración significativa en el crecimiento del PIB durante el aƱo 2020, posiblemente debido a eventos globales o cambios económicos especĆficos de cada paĆs.
Pregunta 2:
Los intervalos de confianza en ambas grĆ”ficas aparecen desalineados, lo que indica una variabilidad en la precisión de las estimaciones promedio entre los diferentes paĆses y aƱos analizados. Esta desalineación de los intervalos de confianza refleja diferencias en la estabilidad de los datos a lo largo del tiempo y entre paĆses, sugiriendo que la confianza en nuestras estimaciones promedio varĆa segĆŗn el contexto.
Pregunta 3:
La presencia de heterogeneidad en los datos indica que existe variabilidad significativa en las mediciones. Esto significa que los datos muestran una diversidad en las tasas de crecimiento del PIB entre diferentes paĆses y a lo largo del tiempo. La heterogeneidad en los datos es importante, ya que sugiere que los factores que influyen en el crecimiento económico varĆan entre paĆses y pueden cambiar significativamente a lo largo de los aƱos.
#Modelo 1. Regresion agrupada(pooled)
pooled<-plm(NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS+
AG.LND.AGRI.ZS+AG.LND.ARBL.ZS+EG.ELC.ACCS.ZS+SP.POP.GROW+GB.XPD.RSDV.GD.ZS , data=panel ,model = "pooling")
## Warning in pdata.frame(data, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
summary(pooled)
## Pooling Model
##
## Call:
## plm(formula = NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS +
## AG.LND.ARBL.ZS + EG.ELC.ACCS.ZS + SP.POP.GROW + GB.XPD.RSDV.GD.ZS,
## data = panel, model = "pooling")
##
## Unbalanced Panel: n = 4, T = 4-4, N = 16
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -8.1043 -1.9711 1.2967 2.3740 5.8281
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## (Intercept) 108.49114 161.77765 0.6706 0.5193
## SL.UEM.TOTL.ZS -0.11244 0.70155 -0.1603 0.8762
## AG.LND.AGRI.ZS 1.07183 0.65102 1.6464 0.1341
## AG.LND.ARBL.ZS 2.14456 1.21025 1.7720 0.1102
## EG.ELC.ACCS.ZS -1.82557 1.44565 -1.2628 0.2384
## SP.POP.GROW -4.69836 4.18512 -1.1226 0.2906
## GB.XPD.RSDV.GD.ZS -1.70636 2.19119 -0.7787 0.4561
##
## Total Sum of Squares: 512.67
## Residual Sum of Squares: 236.86
## R-Squared: 0.53799
## Adj. R-Squared: 0.22998
## F-statistic: 1.74666 on 6 and 9 DF, p-value: 0.21687
#Modelo 2. Efectos fijos(within)
within<-plm(NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS+
AG.LND.AGRI.ZS+AG.LND.ARBL.ZS+EG.ELC.ACCS.ZS+SP.POP.GROW+GB.XPD.RSDV.GD.ZS , data=panel ,model = "within")
## Warning in pdata.frame(data, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
summary(within)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS +
## AG.LND.ARBL.ZS + EG.ELC.ACCS.ZS + SP.POP.GROW + GB.XPD.RSDV.GD.ZS,
## data = panel, model = "within")
##
## Unbalanced Panel: n = 4, T = 4-4, N = 16
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -4.98771 -2.38596 0.41446 1.92653 5.64725
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## SL.UEM.TOTL.ZS -0.60572 0.97119 -0.6237 0.55579
## AG.LND.AGRI.ZS 3.29170 1.43542 2.2932 0.06167 .
## AG.LND.ARBL.ZS 0.47688 2.68288 0.1777 0.86477
## EG.ELC.ACCS.ZS 0.75577 3.26340 0.2316 0.82455
## SP.POP.GROW -3.77042 7.00843 -0.5380 0.60995
## GB.XPD.RSDV.GD.ZS -3.72381 7.02411 -0.5301 0.61505
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 401.22
## Residual Sum of Squares: 144.53
## R-Squared: 0.63977
## Adj. R-Squared: 0.099435
## F-statistic: 1.77603 on 6 and 6 DF, p-value: 0.25126
#Prueba pF
pFtest(within,pooled)
##
## F test for individual effects
##
## data: NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS + AG.LND.ARBL.ZS + ...
## F = 1.2777, df1 = 3, df2 = 6, p-value = 0.364
## alternative hypothesis: significant effects
#Modelo 3. Efectos aleatorios(random) = Metodo walhus
walhus<- plm(NY.GDP.MKTP.KD.ZG ~ +SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS + AG.LND.ARBL.ZS+ EG.ELC.ACCS.ZS+ SP.POP.GROW +GB.XPD.RSDV.GD.ZS, data = bd, model ='random', random.method = 'walhus')
## Warning in pdata.frame(data, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
summary(walhus)
## Oneway (individual) effect Random Effect Model
## (Wallace-Hussain's transformation)
##
## Call:
## plm(formula = NY.GDP.MKTP.KD.ZG ~ +SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS +
## AG.LND.ARBL.ZS + EG.ELC.ACCS.ZS + SP.POP.GROW + GB.XPD.RSDV.GD.ZS,
## data = bd, model = "random", random.method = "walhus")
##
## Unbalanced Panel: n = 4, T = 22-26, N = 99
##
## Effects:
## var std.dev share
## idiosyncratic 12.595 3.549 0.634
## individual 7.258 2.694 0.366
## theta:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.7296 0.7452 0.7499 0.7442 0.7499 0.7499
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -9.6390 -1.6357 0.5489 0.0008 1.7536 9.8348
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 95.35299 51.81528 1.8402 0.065732 .
## SL.UEM.TOTL.ZS -0.41142 0.23863 -1.7241 0.084688 .
## AG.LND.AGRI.ZS 0.61260 0.26456 2.3156 0.020582 *
## AG.LND.ARBL.ZS 0.92455 0.42606 2.1700 0.030009 *
## EG.ELC.ACCS.ZS -1.28399 0.45085 -2.8479 0.004401 **
## SP.POP.GROW -4.41230 2.15552 -2.0470 0.040660 *
## GB.XPD.RSDV.GD.ZS -0.82609 1.20447 -0.6859 0.492803
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1557.7
## Residual Sum of Squares: 1164
## R-Squared: 0.25273
## Adj. R-Squared: 0.20399
## Chisq: 30.7827 on 6 DF, p-value: 2.7889e-05
#Modelo 3. Efectos aleatorios(random) = Metodo amemiya
amemiya<- plm(NY.GDP.MKTP.KD.ZG ~ +SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS + AG.LND.ARBL.ZS+ EG.ELC.ACCS.ZS+ SP.POP.GROW +GB.XPD.RSDV.GD.ZS, data = bd, model ='random', random.method = 'amemiya')
## Warning in pdata.frame(data, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
summary(amemiya)
## Oneway (individual) effect Random Effect Model
## (Amemiya's transformation)
##
## Call:
## plm(formula = NY.GDP.MKTP.KD.ZG ~ +SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS +
## AG.LND.ARBL.ZS + EG.ELC.ACCS.ZS + SP.POP.GROW + GB.XPD.RSDV.GD.ZS,
## data = bd, model = "random", random.method = "amemiya")
##
## Unbalanced Panel: n = 4, T = 22-26, N = 99
##
## Effects:
## var std.dev share
## idiosyncratic 12.765 3.573 0.782
## individual 3.552 1.885 0.218
## theta:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.6253 0.6455 0.6515 0.6442 0.6515 0.6515
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -9.9298 -1.7232 0.5122 -0.0006 1.7030 9.8299
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 99.31748 49.32899 2.0134 0.044076 *
## SL.UEM.TOTL.ZS -0.35816 0.23266 -1.5395 0.123692
## AG.LND.AGRI.ZS 0.59705 0.23228 2.5704 0.010158 *
## AG.LND.ARBL.ZS 1.00722 0.39936 2.5221 0.011666 *
## EG.ELC.ACCS.ZS -1.32527 0.43006 -3.0816 0.002059 **
## SP.POP.GROW -4.87025 2.04537 -2.3811 0.017261 *
## GB.XPD.RSDV.GD.ZS -0.93679 1.07896 -0.8682 0.385263
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1608.7
## Residual Sum of Squares: 1175
## R-Squared: 0.26957
## Adj. R-Squared: 0.22193
## Chisq: 33.3638 on 6 DF, p-value: 8.9239e-06
#Modelo 3. Efectos aleatorios(random) = Metodo nerlove
nerlove<- plm(NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS + AG.LND.ARBL.ZS+ EG.ELC.ACCS.ZS+ SP.POP.GROW +GB.XPD.RSDV.GD.ZS, data = bd, model ='random', random.method = 'nerlove')
## Warning in pdata.frame(data, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
summary(nerlove)
## Oneway (individual) effect Random Effect Model
## (Nerlove's transformation)
##
## Call:
## plm(formula = NY.GDP.MKTP.KD.ZG ~ SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS +
## AG.LND.ARBL.ZS + EG.ELC.ACCS.ZS + SP.POP.GROW + GB.XPD.RSDV.GD.ZS,
## data = bd, model = "random", random.method = "nerlove")
##
## Unbalanced Panel: n = 4, T = 22-26, N = 99
##
## Effects:
## var std.dev share
## idiosyncratic 11.475 3.388 0.332
## individual 23.106 4.807 0.668
## theta:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.8514 0.8604 0.8631 0.8598 0.8631 0.8631
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -9.3668 -1.5509 0.5815 0.0029 1.9156 9.8825
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 80.32725 59.31273 1.3543 0.17564
## SL.UEM.TOTL.ZS -0.47647 0.24603 -1.9366 0.05279 .
## AG.LND.AGRI.ZS 0.69455 0.32794 2.1179 0.03418 *
## AG.LND.ARBL.ZS 0.76875 0.49230 1.5615 0.11839
## EG.ELC.ACCS.ZS -1.14960 0.51719 -2.2228 0.02623 *
## SP.POP.GROW -3.99823 2.27999 -1.7536 0.07950 .
## GB.XPD.RSDV.GD.ZS -0.96033 1.47629 -0.6505 0.51537
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1518.8
## Residual Sum of Squares: 1151
## R-Squared: 0.24215
## Adj. R-Squared: 0.19273
## Chisq: 29.2897 on 6 DF, p-value: 5.3617e-05
#prueba de hausman
phtest(amemiya,within)
##
## Hausman Test
##
## data: NY.GDP.MKTP.KD.ZG ~ +SL.UEM.TOTL.ZS + AG.LND.AGRI.ZS + AG.LND.ARBL.ZS + ...
## chisq = 4.9544, df = 6, p-value = 0.5497
## alternative hypothesis: one model is inconsistent
library(magick)
## Linking to ImageMagick 6.9.12.98
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
gif_url <- image_read("https://i.gifer.com/origin/36/36b951b5410ef7e312548228ae1ab420_w200.gif")
print(gif_url)
## # A tibble: 17 Ć 7
## format width height colorspace matte filesize density
## <chr> <int> <int> <chr> <lgl> <int> <chr>
## 1 GIF 200 168 sRGB TRUE 0 72x72
## 2 GIF 200 168 sRGB TRUE 0 72x72
## 3 GIF 200 168 sRGB TRUE 0 72x72
## 4 GIF 200 168 sRGB TRUE 0 72x72
## 5 GIF 200 168 sRGB TRUE 0 72x72
## 6 GIF 200 168 sRGB TRUE 0 72x72
## 7 GIF 200 168 sRGB TRUE 0 72x72
## 8 GIF 200 168 sRGB TRUE 0 72x72
## 9 GIF 200 168 sRGB TRUE 0 72x72
## 10 GIF 200 168 sRGB TRUE 0 72x72
## 11 GIF 200 168 sRGB TRUE 0 72x72
## 12 GIF 200 168 sRGB TRUE 0 72x72
## 13 GIF 200 168 sRGB TRUE 0 72x72
## 14 GIF 200 168 sRGB TRUE 0 72x72
## 15 GIF 200 168 sRGB TRUE 0 72x72
## 16 GIF 200 168 sRGB TRUE 0 72x72
## 17 GIF 200 168 sRGB TRUE 0 72x72
library(WDI)
library(wbstats)
library(tidyverse)
library(gplots)
library(readxl)
library(plm)
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
bd <- read_excel("C:/Users/roman/OneDrive/Desktop/Gestion/PATENT 3.xls")
# Eliminar filas con valores NA de la base de datos principal
bd <- na.omit(bd)
View(bd)
panel<-select(bd,patentsg,return, year, cusip , employ , rnd, sales,stckpr)
panel<-pdata.frame(panel, index=c("cusip","year"))
# Modelo de efectos fijos (within)
within <- plm(patentsg ~ return + employ + rnd + sales + stckpr, data = panel, index = c("cusip", "year"), model = "within")
# Modelo de efectos aleatorios
walhus <- plm(patentsg ~ return + employ + rnd + sales + stckpr, data = panel, index = c("cusip", "year"), model = "random", random.method = 'walhus')
#Regresion agrupada
pooled<-plm(patentsg ~ return + employ + rnd + sales + stckpr, data = panel, index = c("cusip", "year"), model = "pooling")
# Ver los resĆŗmenes de los modelos
summary(within)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = patentsg ~ return + employ + rnd + sales + stckpr,
## data = panel, model = "within", index = c("cusip", "year"))
##
## Unbalanced Panel: n = 215, T = 2-10, N = 2083
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -219.22852 -2.15429 -0.32051 1.82530 267.24979
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## return -0.05875796 0.10859324 -0.5411 0.58852
## employ -0.06008489 0.06378744 -0.9420 0.34634
## rnd -0.13925828 0.01277223 -10.9032 < 2.2e-16 ***
## sales -0.00157648 0.00036809 -4.2829 1.938e-05 ***
## stckpr 0.05327363 0.02907453 1.8323 0.06706 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 713530
## Residual Sum of Squares: 587240
## R-Squared: 0.177
## Adj. R-Squared: 0.080254
## F-statistic: 80.1338 on 5 and 1863 DF, p-value: < 2.22e-16
summary(walhus)
## Oneway (individual) effect Random Effect Model
## (Wallace-Hussain's transformation)
##
## Call:
## plm(formula = patentsg ~ return + employ + rnd + sales + stckpr,
## data = panel, model = "random", random.method = "walhus",
## index = c("cusip", "year"))
##
## Unbalanced Panel: n = 215, T = 2-10, N = 2083
##
## Effects:
## var std.dev share
## idiosyncratic 491.88 22.18 0.182
## individual 2206.61 46.97 0.818
## theta:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.6833 0.8523 0.8523 0.8504 0.8523 0.8523
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -145.414 -4.430 -2.204 0.037 0.557 307.273
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 14.02575017 3.21531882 4.3622 1.288e-05 ***
## return -0.12918817 0.12078351 -1.0696 0.2848
## employ 0.86554048 0.04969144 17.4183 < 2.2e-16 ***
## rnd -0.09578384 0.01366226 -7.0108 2.369e-12 ***
## sales -0.00243471 0.00039724 -6.1290 8.843e-10 ***
## stckpr 0.20200524 0.03136593 6.4403 1.193e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1004200
## Residual Sum of Squares: 828750
## R-Squared: 0.17473
## Adj. R-Squared: 0.17275
## Chisq: 441.974 on 5 DF, p-value: < 2.22e-16
summary(pooled)
## Pooling Model
##
## Call:
## plm(formula = patentsg ~ return + employ + rnd + sales + stckpr,
## data = panel, model = "pooling", index = c("cusip", "year"))
##
## Unbalanced Panel: n = 215, T = 2-10, N = 2083
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -374.0512 -11.1835 0.5751 7.7176 534.3202
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## (Intercept) -1.0079e+01 2.1869e+00 -4.6090 4.293e-06 ***
## return -4.3803e-03 2.2588e-01 -0.0194 0.9845
## employ 1.4468e+00 4.7690e-02 30.3365 < 2.2e-16 ***
## rnd -1.1653e-01 1.8397e-02 -6.3344 2.913e-10 ***
## sales -2.7178e-03 5.3251e-04 -5.1037 3.633e-07 ***
## stckpr 7.5405e-01 4.9816e-02 15.1367 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 14044000
## Residual Sum of Squares: 5522100
## R-Squared: 0.60679
## Adj. R-Squared: 0.60584
## F-statistic: 641.025 on 5 and 2077 DF, p-value: < 2.22e-16
plotmeans(panel$patentsg ~ panel$year,xlab="AƱos",ylab="Patentes",
mean.labels=TRUE, digits=-3,
col="red",connect=TRUE, main="Heterogeneidad entre patentes")
suppressWarnings({
plotmeans(panel$patentsg ~ panel$cusip,xlab="Empresas",ylab="Patentes",
mean.labels=TRUE, digits=-3,
col="red",connect=TRUE, main="Heterogeneidad entre empresas")
})
##Pruebas para comprbar la heterocedasticidas y la auto-correlacion
# Prueba de Hausman
phtest(walhus, within)
##
## Hausman Test
##
## data: patentsg ~ return + employ + rnd + sales + stckpr
## chisq = 501.39, df = 5, p-value < 2.2e-16
## alternative hypothesis: one model is inconsistent
# Prueba de heterocedasticidad: Breusch-Pagan
#bp_test <- bptest(within)
#bp_test
# Prueba de autocorrelación serial: Wooldridge test for panel data
#wooldridge_test <- pdwtest(within)