library(wooldridge)
## Warning: package 'wooldridge' was built under R version 4.1.3
library(rmarkdown)
data("corn")
paged_table(corn)
summary(corn)
## county cornhec soyhec cornpix
## Min. : 1.000 Min. : 64.75 Min. : 6.47 Min. :145.0
## 1st Qu.: 6.000 1st Qu.: 96.32 1st Qu.: 76.49 1st Qu.:246.0
## Median : 9.000 Median :116.43 Median :102.59 Median :295.0
## Mean : 8.243 Mean :120.43 Mean : 96.35 Mean :297.4
## 3rd Qu.:11.000 3rd Qu.:140.43 3rd Qu.:124.44 3rd Qu.:353.0
## Max. :12.000 Max. :206.39 Max. :174.34 Max. :459.0
## soypix
## Min. : 55.0
## 1st Qu.:167.0
## Median :206.0
## Mean :203.3
## 3rd Qu.:249.0
## Max. :345.0
mean(corn$cornhec)
## [1] 120.4324
mean(corn$soyhec)
## [1] 96.34595
var(corn$soypix)
## [1] 4546.447
lm(formula = county~cornhec+soyhec+cornpix+soypix, data = corn)
##
## Call:
## lm(formula = county ~ cornhec + soyhec + cornpix + soypix, data = corn)
##
## Coefficients:
## (Intercept) cornhec soyhec cornpix soypix
## 2.938875 -0.010709 0.050500 0.011069 -0.007689
yahya1<-lm(formula = county~cornhec+cornpix,data = corn)
summary(yahya1)
##
## Call:
## lm(formula = county ~ cornhec + cornpix, data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.534 -2.151 1.086 2.020 4.930
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.87112 2.23995 4.407 9.95e-05 ***
## cornhec -0.03972 0.02784 -1.427 0.163
## cornpix 0.01061 0.01292 0.821 0.417
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.085 on 34 degrees of freedom
## Multiple R-squared: 0.06672, Adjusted R-squared: 0.01183
## F-statistic: 1.215 on 2 and 34 DF, p-value: 0.3092
cornpix(hektar başına mısır pikseli)sabit tutulduğunda cornhec %0.03972 azaltığını göstermektedir.
yahya2<-lm(formula = county~soyhec+soypix, data = corn)
summary(yahya2)
##
## Call:
## lm(formula = county ~ soyhec + soypix, data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.5536 -1.3404 0.4802 1.3998 5.6731
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.02636 1.50048 4.016 0.000309 ***
## soyhec 0.05508 0.02170 2.539 0.015874 *
## soypix -0.01520 0.01262 -1.204 0.236779
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.836 on 34 degrees of freedom
## Multiple R-squared: 0.2113, Adjusted R-squared: 0.1649
## F-statistic: 4.553 on 2 and 34 DF, p-value: 0.0177
soypix sabit tutulduğunda soyhec çok fazla değişmedi ancak soypix %0.01 azaldığını göstermektedir.
R’de standardizasyon yapmak için scale komutunu kullanırız
lm(scale(county)~0+scale(cornhec)+scale(cornpix)+scale(soyhec)+scale(soypix),data = corn)
##
## Call:
## lm(formula = scale(county) ~ 0 + scale(cornhec) + scale(cornpix) +
## scale(soyhec) + scale(soypix), data = corn)
##
## Coefficients:
## scale(cornhec) scale(cornpix) scale(soyhec) scale(soypix)
## -0.1127 0.2509 0.6380 -0.1670
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
stargazer(yahya1,yahya2, type = "text")
##
## ==========================================================
## Dependent variable:
## ----------------------------
## county
## (1) (2)
## ----------------------------------------------------------
## cornhec -0.040
## (0.028)
##
## cornpix 0.011
## (0.013)
##
## soyhec 0.055**
## (0.022)
##
## soypix -0.015
## (0.013)
##
## Constant 9.871*** 6.026***
## (2.240) (1.500)
##
## ----------------------------------------------------------
## Observations 37 37
## R2 0.067 0.211
## Adjusted R2 0.012 0.165
## Residual Std. Error (df = 34) 3.085 2.836
## F Statistic (df = 2; 34) 1.215 4.553**
## ==========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
summary(yahya1)
##
## Call:
## lm(formula = county ~ cornhec + cornpix, data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.534 -2.151 1.086 2.020 4.930
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.87112 2.23995 4.407 9.95e-05 ***
## cornhec -0.03972 0.02784 -1.427 0.163
## cornpix 0.01061 0.01292 0.821 0.417
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.085 on 34 degrees of freedom
## Multiple R-squared: 0.06672, Adjusted R-squared: 0.01183
## F-statistic: 1.215 on 2 and 34 DF, p-value: 0.3092
y4<- lm((county)~log(cornhec)+log(cornpix)+log(soyhec)+log(soypix),data = corn)
summary(y4)
##
## Call:
## lm(formula = (county) ~ log(cornhec) + log(cornpix) + log(soyhec) +
## log(soypix), data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.9180 -1.8430 0.1879 1.3693 4.9259
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -12.709 21.696 -0.586 0.5621
## log(cornhec) -1.402 3.226 -0.434 0.6669
## log(cornpix) 3.666 3.723 0.985 0.3322
## log(soyhec) 3.041 1.249 2.435 0.0207 *
## log(soypix) -1.251 2.479 -0.505 0.6171
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.79 on 32 degrees of freedom
## Multiple R-squared: 0.2817, Adjusted R-squared: 0.1919
## F-statistic: 3.137 on 4 and 32 DF, p-value: 0.02767
anova(y4)
## Analysis of Variance Table
##
## Response: (county)
## Df Sum Sq Mean Sq F value Pr(>F)
## log(cornhec) 1 10.818 10.818 1.3896 0.247168
## log(cornpix) 1 6.210 6.210 0.7977 0.378462
## log(soyhec) 1 78.675 78.675 10.1058 0.003272 **
## log(soypix) 1 1.984 1.984 0.2548 0.617143
## Residuals 32 249.124 7.785
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary((lm(formula = county~cornhec+soyhec+cornpix+soypix, data = corn)))
##
## Call:
## lm(formula = county ~ cornhec + soyhec + cornpix + soypix, data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.8991 -1.3720 0.0584 1.3114 5.4276
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.938875 4.952355 0.593 0.5571
## cornhec -0.010709 0.029204 -0.367 0.7163
## soyhec 0.050500 0.024725 2.042 0.0494 *
## cornpix 0.011069 0.014938 0.741 0.4641
## soypix -0.007689 0.016077 -0.478 0.6357
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.896 on 32 degrees of freedom
## Multiple R-squared: 0.226, Adjusted R-squared: 0.1293
## F-statistic: 2.336 on 4 and 32 DF, p-value: 0.07657
aldığımız data bu verıler içerisinde var county ilçe numarası cornhec hektar başına mısır soyahec hektar başına soya fasulyesi cornpix hektar başına mısır piksel soyapix hektar başına soya piksel
bulduğumuz verilere göre corhec %0.010 azaldığını ancak cornhec %1 artmış meydana geldiğini görülmektedir soyahec 0.0505 artığını ancak soyapix %0.7 azldığını göstermektedir
summary((lm(formula = county~cornhec+soyhec+cornpix+soypix-1, data = corn)))
##
## Call:
## lm(formula = county ~ cornhec + soyhec + cornpix + soypix - 1,
## data = corn)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.457 -1.479 -0.173 1.522 5.947
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## cornhec -0.009297 0.028820 -0.323 0.7490
## soyhec 0.050451 0.024481 2.061 0.0473 *
## cornpix 0.016336 0.011897 1.373 0.1790
## soypix -0.001885 0.012635 -0.149 0.8823
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.868 on 33 degrees of freedom
## Multiple R-squared: 0.9051, Adjusted R-squared: 0.8936
## F-statistic: 78.72 on 4 and 33 DF, p-value: < 2.2e-16