Q1:找出三種職業類型的中位數

載入、瀏覽資料

## 'data.frame':    102 obs. of  6 variables:
##  $ education: num  13.1 12.3 12.8 11.4 14.6 ...
##  $ income   : int  12351 25879 9271 8865 8403 11030 8258 14163 11377 11023 ...
##  $ women    : num  11.16 4.02 15.7 9.11 11.68 ...
##  $ prestige : num  68.8 69.1 63.4 56.8 73.5 77.6 72.6 78.1 73.1 68.8 ...
##  $ census   : int  1113 1130 1171 1175 2111 2113 2133 2141 2143 2153 ...
##  $ type     : Factor w/ 3 levels "bc","prof","wc": 2 2 2 2 2 2 2 2 2 2 ...

找出中位數

##   type prestige
## 1   bc     35.9
## 2 prof     68.4
## 3   wc     41.5

Q2:職業類型Income & Education的關係

切割出職業類型為bc的資料

依照prestige的中位數分為“Low”, “High”

##    0%   10%   20%   30%   40%   50%   60%   70%   80%   90%  100% 
## 17.30 22.01 25.74 28.74 34.82 35.90 37.92 41.84 43.58 50.27 54.90

Relationship between income and education for “bc”

## $Low
## (Intercept) x$education 
##   3399.4175     87.3788 
## 
## $High
## (Intercept) x$education 
##   1870.5507    564.2745

切割出職業類型為prof的資料

依照prestige的中位數分為“Low”, “High”

##   0%  10%  20%  30%  40%  50%  60%  70%  80%  90% 100% 
## 53.8 57.2 59.6 62.2 66.1 68.4 69.1 72.6 73.5 78.1 87.2

Relationship between income and education for “prof”

## $Low
## (Intercept) x$education 
##    36.69381   607.11066 
## 
## $High
##  (Intercept)  x$education 
## 12807.634864    -1.164548

切割出職業類型為wc的資料

依照prestige的中位數分為“Low”, “High”

##    0%   10%   20%   30%   40%   50%   60%   70%   80%   90%  100% 
## 26.50 31.26 35.64 36.76 38.58 41.50 43.04 47.18 48.72 51.10 67.50

Relationship between income and education for “wc”

## $Low
## (Intercept) x$education 
##   7812.3227   -299.4227 
## 
## $High
## (Intercept) x$education 
##  -3660.2745    803.7285