library(wooldridge)
## Warning: package 'wooldridge' was built under R version 4.0.5
data(hprice1)
head(force(hprice1),n=5) #se muestran primeras 5 observaciones
## price assess bdrms lotsize sqrft colonial lprice lassess llotsize lsqrft
## 1 300 349.1 4 6126 2438 1 5.703783 5.855359 8.720297 7.798934
## 2 370 351.5 3 9903 2076 1 5.913503 5.862210 9.200593 7.638198
## 3 191 217.7 3 5200 1374 0 5.252274 5.383118 8.556414 7.225482
## 4 195 231.8 3 4600 1448 1 5.273000 5.445875 8.433811 7.277938
## 5 373 319.1 4 6095 2514 1 5.921578 5.765504 8.715224 7.829630
1 ESTIMACION DEL MODELO
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
price<-lm(price~lotsize+sqrft+bdrms,data = hprice1)
stargazer(price,title = "modelo estimado")
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: sáb., may. 29, 2021 - 11:18:53 p. m.
## \begin{table}[!htbp] \centering
## \caption{modelo estimado}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## & \multicolumn{1}{c}{\textit{Dependent variable:}} \\
## \cline{2-2}
## \\[-1.8ex] & price \\
## \hline \\[-1.8ex]
## lotsize & 0.002$^{***}$ \\
## & (0.001) \\
## & \\
## sqrft & 0.123$^{***}$ \\
## & (0.013) \\
## & \\
## bdrms & 13.853 \\
## & (9.010) \\
## & \\
## Constant & $-$21.770 \\
## & (29.475) \\
## & \\
## \hline \\[-1.8ex]
## Observations & 88 \\
## R$^{2}$ & 0.672 \\
## Adjusted R$^{2}$ & 0.661 \\
## Residual Std. Error & 59.833 (df = 84) \\
## F Statistic & 57.460$^{***}$ (df = 3; 84) \\
## \hline
## \hline \\[-1.8ex]
## \textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
## \end{tabular}
## \end{table}
##2VERIFIQUE EL SUPUESTO DE NOMRALIDAD , A TRAVES DE: 1 PRUEBA JB
library(normtest) #Carga los comandos para las pruebas de normalidad
jb.norm.test(hprice1) #Ejecuta la prueba de Jarque -Bera
##
## Jarque-Bera test for normality
##
## data: hprice1
## JB = 3.7405, p-value = 0.0305
##2 PRUEBA KS
library(nortest) #Carga los comandos para las pruebas de normalidad
lillie.test(hprice1$price) #Ejecuta la prueba KS, con la corrección de Lilliefors
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: hprice1$price
## D = 0.14748, p-value = 6.538e-05
##3 PRUEBA SW
library(fastGraph)
## Warning: package 'fastGraph' was built under R version 4.0.5
shapiro.test(hprice1$price)
##
## Shapiro-Wilk normality test
##
## data: hprice1$price
## W = 0.82417, p-value = 7.6e-09
shadeDist()