library(wooldridge) # data komutuyla fertil1 verisetini indirmek içim
library(rmarkdown) # page_table komutuyla veri setini rmarkdown üzerinde gösterebilmek için
data("fertil1")
paged_table(fertil1)
require(dplyr)
## Zorunlu paket yükleniyor: dplyr
## Warning: package 'dplyr' was built under R version 4.2.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
fertil1 %>%
group_by(year) %>%
summarise("ortalama çocuk sayısı (kids)" = mean(kids))
## # A tibble: 7 × 2
## year `ortalama çocuk sayısı (kids)`
## <int> <dbl>
## 1 72 3.03
## 2 74 3.21
## 3 76 2.80
## 4 78 2.80
## 5 80 2.82
## 6 82 2.40
## 7 84 2.24
require(dplyr)
fertil1 %>%
group_by(year) %>%
summarise(across(everything(), mean))
## # A tibble: 7 × 27
## year educ meduc feduc age kids black east northcen west farm othru…¹
## <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 72 12.2 8.33 8.90 44.9 3.03 0.0833 0.333 0.231 0.128 0.173 0.0833
## 2 74 12.3 8.94 9.29 44.1 3.21 0.0578 0.237 0.353 0.110 0.208 0.110
## 3 76 12.2 8.25 8.99 43.5 2.80 0.0461 0.263 0.316 0.0855 0.237 0.112
## 4 78 12.6 9.07 9.80 43.4 2.80 0.0490 0.273 0.329 0.105 0.203 0.112
## 5 80 12.9 9.40 9.95 43.7 2.82 0.0704 0.141 0.394 0.155 0.218 0.106
## 6 82 13.2 9.56 10.2 43.2 2.40 0.199 0.231 0.290 0.0806 0.167 0.118
## 7 84 13.3 10.2 10.7 41.8 2.24 0.0678 0.260 0.333 0.102 0.192 0.0734
## # … with 15 more variables: town <dbl>, smcity <dbl>, y74 <dbl>, y76 <dbl>,
## # y78 <dbl>, y80 <dbl>, y82 <dbl>, y84 <dbl>, agesq <dbl>, y74educ <dbl>,
## # y76educ <dbl>, y78educ <dbl>, y80educ <dbl>, y82educ <dbl>, y84educ <dbl>,
## # and abbreviated variable name ¹othrural
require(dplyr)
fertil1 %>%
group_by(year) %>%
summarise("ortalama çocuk sayısı (kids)" = mean(kids), "stadandart sapma çocuk sayısı (kids)" = sd(kids) )
## # A tibble: 7 × 3
## year `ortalama çocuk sayısı (kids)` `stadandart sapma çocuk sayısı (kids)`
## <int> <dbl> <dbl>
## 1 72 3.03 1.83
## 2 74 3.21 1.50
## 3 76 2.80 1.66
## 4 78 2.80 1.58
## 5 80 2.82 1.58
## 6 82 2.40 1.70
## 7 84 2.24 1.51
summary(lm(kids ~ educ + age + I(age^2) + black + east + northcen + west + farm + othrural + town + smcity + y74 + y76 + y78 + y80 + y82 + y84, data = fertil1))
##
## Call:
## lm(formula = kids ~ educ + age + I(age^2) + black + east + northcen +
## west + farm + othrural + town + smcity + y74 + y76 + y78 +
## y80 + y82 + y84, data = fertil1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9878 -1.0086 -0.0767 0.9331 4.6548
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -7.742457 3.051767 -2.537 0.011315 *
## educ -0.128427 0.018349 -6.999 4.44e-12 ***
## age 0.532135 0.138386 3.845 0.000127 ***
## I(age^2) -0.005804 0.001564 -3.710 0.000217 ***
## black 1.075658 0.173536 6.198 8.02e-10 ***
## east 0.217324 0.132788 1.637 0.101992
## northcen 0.363114 0.120897 3.004 0.002729 **
## west 0.197603 0.166913 1.184 0.236719
## farm -0.052557 0.147190 -0.357 0.721105
## othrural -0.162854 0.175442 -0.928 0.353481
## town 0.084353 0.124531 0.677 0.498314
## smcity 0.211879 0.160296 1.322 0.186507
## y74 0.268183 0.172716 1.553 0.120771
## y76 -0.097379 0.179046 -0.544 0.586633
## y78 -0.068666 0.181684 -0.378 0.705544
## y80 -0.071305 0.182771 -0.390 0.696511
## y82 -0.522484 0.172436 -3.030 0.002502 **
## y84 -0.545166 0.174516 -3.124 0.001831 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.555 on 1111 degrees of freedom
## Multiple R-squared: 0.1295, Adjusted R-squared: 0.1162
## F-statistic: 9.723 on 17 and 1111 DF, p-value: < 2.2e-16