Rで共変量プロットを描く。
library(AER) data(CPS1985) fit <- lm(formula = wage ~ education + age + gender + occupation + union, data = CPS1985) summary(fit)
結果の表示。
Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.86545 1.37469 -1.357 0.175368 education 0.59565 0.09350 6.370 4.13e-10 *** age 0.09476 0.01656 5.723 1.77e-08 *** genderfemale -1.81460 0.41555 -4.367 1.52e-05 *** occupationtechnical 1.53776 0.68990 2.229 0.026240 * occupationservices -1.34311 0.60762 -2.210 0.027507 * occupationoffice -0.58774 0.63256 -0.929 0.353245 occupationsales -1.20902 0.81515 -1.483 0.138626 occupationmanagement 2.82736 0.75765 3.732 0.000211 *** unionyes 1.58683 0.50749 3.127 0.001865 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
信頼区間は次のように出力する。95%と90%を設定する。それぞれ5%有意と10%有意に相当する。
confint(fit, level = 0.95) confint(fit, level = 0.90)
それぞれの結果の表示。
2.5 % 97.5 % (Intercept) -4.56604008 0.8351387 education 0.41196295 0.7793276 age 0.06222812 0.1272862 genderfemale -2.63095640 -0.9982519 occupationtechnical 0.18244561 2.8930780 occupationservices -2.53677803 -0.1494321 occupationoffice -1.83041166 0.6549327 occupationsales -2.81038993 0.3923436 occupationmanagement 1.33895379 4.3157634 unionyes 0.58986138 2.5837930 5 % 95 % (Intercept) -4.13062657 0.3997252 education 0.44157788 0.7497127 age 0.06747275 0.1220416 genderfemale -2.49933668 -1.1298716 occupationtechnical 0.40096199 2.6745617 occupationservices -2.34432325 -0.3418869 occupationoffice -1.63005678 0.4545778 occupationsales -2.55220306 0.1341567 occupationmanagement 1.57892791 4.0757893 unionyes 0.75060125 2.4230531
このままでは少し見づらいので、共変量プロットで図で確かめる。
library(coefplot) coefplot(fit)