library("readstata13", lib.loc="~/R/win-library/3.2")
setwd("C:/Users/marcogeovanni/OneDrive/Documentos/Chapter 2")
mm <- read.dta13("wages1.dta")
attach(mm)
summary(mm)
## exper male school wage
## Min. : 1.000 Min. :0.0000 Min. : 3.00 Min. : 0.07656
## 1st Qu.: 7.000 1st Qu.:0.0000 1st Qu.:11.00 1st Qu.: 3.62157
## Median : 8.000 Median :1.0000 Median :12.00 Median : 5.20578
## Mean : 8.043 Mean :0.5237 Mean :11.63 Mean : 5.75759
## 3rd Qu.: 9.000 3rd Qu.:1.0000 3rd Qu.:12.00 3rd Qu.: 7.30451
## Max. :18.000 Max. :1.0000 Max. :16.00 Max. :39.80892
str(mm)
## 'data.frame': 3294 obs. of 4 variables:
## $ exper : num 9 12 11 9 8 9 8 10 12 7 ...
## $ male : num 0 0 0 0 0 0 0 0 0 0 ...
## $ school: num 13 12 11 14 14 14 12 12 10 12 ...
## $ wage : num 6.32 5.48 3.64 4.59 2.42 ...
## - attr(*, "datalabel")= chr ""
## - attr(*, "time.stamp")= chr "13 Jun 2004 11:56"
## - attr(*, "formats")= chr "%9.0g" "%9.0g" "%9.0g" "%9.0g"
## - attr(*, "types")= int 254 254 254 254
## - attr(*, "val.labels")= chr "" "" "" ""
## - attr(*, "var.labels")= chr "" "" "" ""
## - attr(*, "version")= int 110
## - attr(*, "label.table")= list()
## - attr(*, "expansion.fields")= list()
## - attr(*, "byteorder")= int 2
hist(wage, col="blue")

hist(male, col="yellow")

plot(male, wage)
cc <-lm(wage~ male)
summary(cc)
##
## Call:
## lm(formula = wage ~ male)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.160 -2.102 -0.554 1.487 33.496
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.14692 0.08122 63.37 <2e-16 ***
## male 1.16610 0.11224 10.39 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.217 on 3292 degrees of freedom
## Multiple R-squared: 0.03175, Adjusted R-squared: 0.03145
## F-statistic: 107.9 on 1 and 3292 DF, p-value: < 2.2e-16
abline(cc, col="red")
