差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
mselab:2012:stat:week2:r2 [2012/12/11 14:40] – [データの説明] watalu | mselab:2012:stat:week2:r2 [不明な日付] (現在) – 外部編集 (不明な日付) 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
===== 統計工学 2週目 ===== | ===== 統計工学 2週目 ===== | ||
==== はじめに ==== | ==== はじめに ==== | ||
+ | === 連絡 2012.12.11 === | ||
+ | |||
+ | * 自分で頑張って、とお願いした、回帰分析と決定木分析のコードを追記しました。 | ||
+ | * このページを実験時間中に改訂しましたが、[[http:// | ||
+ | * TICデータの[[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | |||
=== 概要 === | === 概要 === | ||
行 17: | 行 26: | ||
に取り組んで貰う。 | に取り組んで貰う。 | ||
- | |||
==== 実験の流れ ==== | ==== 実験の流れ ==== | ||
行 103: | 行 111: | ||
**問2:このplot関数の出力結果を、配付資料と対比させて理解せよ。** | **問2:このplot関数の出力結果を、配付資料と対比させて理解せよ。** | ||
- | == 重回帰分析 == | + | === 重回帰分析 |
表5.1のデータは次のように入力する。 | 表5.1のデータは次のように入力する。 | ||
行 134: | 行 142: | ||
**問4:このplot関数の出力結果を、配付資料と対比させて理解せよ。** | **問4:このplot関数の出力結果を、配付資料と対比させて理解せよ。** | ||
- | == 重回帰応用(水準変数が説明変数に含まれる場合) == | + | === 重回帰応用(水準変数が説明変数に含まれる場合) |
上のデータを、広さを「広め(w)」「狭め(n)」とし、築年数も「新しめ(new)」「古め(old)」にする | 上のデータを、広さを「広め(w)」「狭め(n)」とし、築年数も「新しめ(new)」「古め(old)」にする | ||
行 153: | 行 161: | ||
</ | </ | ||
- | === 時間内課題2:決定木分析の自習 === | + | ==== 時間内課題2:決定木分析の自習 |
まず、次の一行を実行しておく。 | まず、次の一行を実行しておく。 | ||
行 167: | 行 175: | ||
print(rpart.4.1) | print(rpart.4.1) | ||
summary(rpart.4.1) | summary(rpart.4.1) | ||
+ | plot(rpart.4.1) | ||
+ | text(rpart.4.1) | ||
+ | </ | ||
+ | |||
+ | < | ||
rpart.5.1 <- rpart(y~x.1+x.2, | rpart.5.1 <- rpart(y~x.1+x.2, | ||
print(rpart.5.1) | print(rpart.5.1) | ||
summary(rpart.5.1) | summary(rpart.5.1) | ||
+ | plot(rpart.5.1) | ||
+ | text(rpart.5.1) | ||
+ | </ | ||
+ | |||
+ | < | ||
rpart.5.1.c <- rpart(y~x.1+x.2, | rpart.5.1.c <- rpart(y~x.1+x.2, | ||
print(rpart.5.1.c) | print(rpart.5.1.c) | ||
summary(rpart.5.1.c) | summary(rpart.5.1.c) | ||
+ | plot(rpart.5.1.c) | ||
+ | text(rpart.5.1.c) | ||
</ | </ | ||
- | **問6:これらがどのようなモデルか、データと出力に照らして検討せよ。** | + | **問6:これらがどのようなモデルか、データと出力に照らして検討せよ。** |
==== 課題:保険会社の顧客データのデータマイニング ==== | ==== 課題:保険会社の顧客データのデータマイニング ==== | ||
行 209: | 行 228: | ||
[[http:// | [[http:// | ||
- | |変数|分類|メモ| | + | ^変数^分類^メモ^ |
|V1|顧客分類2|L0でコード化されている、数字の大きさに意味なし| | |V1|顧客分類2|L0でコード化されている、数字の大きさに意味なし| | ||
|V2|住居数|大きいほど住む箇所が多い| | |V2|住居数|大きいほど住む箇所が多い| | ||
行 246: | 行 265: | ||
^Nr^Name^Description Domain^ | ^Nr^Name^Description Domain^ | ||
|V1|MOSTYPE|Customer Subtype see L0| | |V1|MOSTYPE|Customer Subtype see L0| | ||
- | |V2|MAANTHUI|Number of houses 1 � 10| | + | |V2|MAANTHUI|Number of houses 1 - 10| |
- | |V3|MGEMOMV|Avg size household 1 � 6| | + | |V3|MGEMOMV|Avg size household 1 - 6| |
|V4|MGEMLEEF|Avg age see L1| | |V4|MGEMLEEF|Avg age see L1| | ||
|V5|MOSHOOFD|Customer main type see L2| | |V5|MOSHOOFD|Customer main type see L2| | ||
行 253: | 行 272: | ||
|V7|MGODPR|Protestant ...| | |V7|MGODPR|Protestant ...| | ||
|V8|MGODOV|Other religion| | |V8|MGODOV|Other religion| | ||
- | |V9|MGODGE|No religion| | + | |V9|MGODGE|No religion |
- | |V10|MRELGE|Married| | + | |V10|MRELGE|Married |
- | |V11|MRELSA|Living together| | + | |V11|MRELSA|Living together |
- | |V12|MRELOV|Other relation| | + | |V12|MRELOV|Other relation |
- | |V13|MFALLEEN|Singles| | + | |V13|MFALLEEN|Singles |
- | |V14|MFGEKIND|Household without children| | + | |V14|MFGEKIND|Household without children |
- | |V15|MFWEKIND|Household with children| | + | |V15|MFWEKIND|Household with children |
- | |V16|MOPLHOOG|High level education| | + | |V16|MOPLHOOG|High level education |
- | |V17|MOPLMIDD|Medium level education| | + | |V17|MOPLMIDD|Medium level education |
- | |V18|MOPLLAAG|Lower level education| | + | |V18|MOPLLAAG|Lower level education |
|V19|MBERHOOG|High status| | |V19|MBERHOOG|High status| | ||
|V20|MBERZELF|Entrepreneur| | |V20|MBERZELF|Entrepreneur| | ||
- | |V21|MBERBOER|Farmer| | + | |V21|MBERBOER|Farmer |
- | |V22|MBERMIDD|Middle management| | + | |V22|MBERMIDD|Middle management |
- | |V23|MBERARBG|Skilled labourers| | + | |V23|MBERARBG|Skilled labourers |
- | |V24|MBERARBO|Unskilled labourers| | + | |V24|MBERARBO|Unskilled labourers |
|V25|MSKA|Social class A| | |V25|MSKA|Social class A| | ||
|V26|MSKB1|Social class B1| | |V26|MSKB1|Social class B1| | ||
行 276: | 行 295: | ||
|V30|MHHUUR|Rented house| | |V30|MHHUUR|Rented house| | ||
|V31|MHKOOP|Home owners| | |V31|MHKOOP|Home owners| | ||
- | |V32|MAUT1|1 car| | + | |V32|MAUT1|1 car (保有車1台)| |
- | |V33|MAUT2|2 cars| | + | |V33|MAUT2|2 cars (保有車2台)| |
- | |V34|MAUT0|No car| | + | |V34|MAUT0|No car (保有車なし)| |
|V35|MZFONDS|National Health Service| | |V35|MZFONDS|National Health Service| | ||
|V36|MZPART|Private health insurance| | |V36|MZPART|Private health insurance| | ||
|V37|MINKM30|Income < 30.000| | |V37|MINKM30|Income < 30.000| | ||
- | |V38|MINK3045|Income 30-45.000| | + | |V38|MINK3045|Income |
- | |V39|MINK4575|Income 45-75.000| | + | |V39|MINK4575|Income |
- | |V40|MINK7512|Income 75-122.000| | + | |V40|MINK7512|Income |
- | |V41|MINK123M|Income > | + | |V41|MINK123M|Income |
- | |V42|MINKGEM|Average income| | + | |V42|MINKGEM|Average income |
|V43|MKOOPKLA|Purchasing power class| | |V43|MKOOPKLA|Purchasing power class| | ||
- | |V44|PWAPART|Contribution private third party insurance see L4| | + | |V44|PWAPART|Contribution |
- | |V45|PWABEDR|Contribution third party insurance (firms) ...| | + | |V45|PWABEDR|Contribution |
- | |V46|PWALAND|Contribution third party insurane (agriculture)| | + | |V46|PWALAND|Contribution |
- | |V47|PPERSAUT|Contribution car policies| | + | |V47|PPERSAUT|Contribution |
- | |V48|PBESAUT|Contribution delivery van policies| | + | |V48|PBESAUT|Contribution |
- | |V49|PMOTSCO|Contribution motorcycle/ | + | |V49|PMOTSCO|Contribution |
- | |V50|PVRAAUT|Contribution lorry policies| | + | |V50|PVRAAUT|Contribution |
- | |V51|PAANHANG|Contribution trailer policies| | + | |V51|PAANHANG|Contribution |
- | |V52|PTRACTOR|Contribution tractor policies| | + | |V52|PTRACTOR|Contribution |
- | |V53|PWERKT|Contribution agricultural machines policies | | + | |V53|PWERKT|Contribution |
- | |V54|PBROM|Contribution moped policies| | + | |V54|PBROM|Contribution |
- | |V55|PLEVEN|Contribution life insurances| | + | |V55|PLEVEN|Contribution |
- | |V56|PPERSONG|Contribution private accident insurance policies| | + | |V56|PPERSONG|Contribution |
- | |V57|PGEZONG|Contribution family accidents insurance policies| | + | |V57|PGEZONG|Contribution |
- | |V58|PWAOREG|Contribution disability insurance policies| | + | |V58|PWAOREG|Contribution |
- | |V59|PBRAND|Contribution fire policies| | + | |V59|PBRAND|Contribution |
- | |V60|PZEILPL|Contribution surfboard policies| | + | |V60|PZEILPL|Contribution |
- | |V61|PPLEZIER|Contribution boat policies| | + | |V61|PPLEZIER|Contribution |
- | |V62|PFIETS|Contribution bicycle policies| | + | |V62|PFIETS|Contribution |
- | |V63|PINBOED|Contribution property insurance policies| | + | |V63|PINBOED|Contribution |
- | |V64|PBYSTAND|Contribution social security insurance policies| | + | |V64|PBYSTAND|Contribution |
- | |V65|AWAPART|Number of private third party insurance 1 - 12| | + | |V65|AWAPART|Number of (契約口数) |
- | |V66|AWABEDR|Number of third party insurance (firms) ...| | + | |V66|AWABEDR|Number of (契約口数) |
- | |V67|AWALAND|Number of third party insurane (agriculture)| | + | |V67|AWALAND|Number of (契約口数) |
- | |V68|APERSAUT|Number of car policies| | + | |V68|APERSAUT|Number of (契約口数) |
- | |V69|ABESAUT|Number of delivery van policies| | + | |V69|ABESAUT|Number of (契約口数) |
- | |V70|AMOTSCO|Number of motorcycle/ | + | |V70|AMOTSCO|Number of (契約口数) |
- | |V71|AVRAAUT|Number of lorry policies| | + | |V71|AVRAAUT|Number of (契約口数) |
- | |V72|AAANHANG|Number of trailer policies| | + | |V72|AAANHANG|Number of (契約口数) |
- | |V73|ATRACTOR|Number of tractor policies| | + | |V73|ATRACTOR|Number of (契約口数) |
- | |V74|AWERKT|Number of agricultural machines policies| | + | |V74|AWERKT|Number of (契約口数) |
- | |V75|ABROM|Number of moped policies| | + | |V75|ABROM|Number of (契約口数) |
- | |V76|ALEVEN|Number of life insurances| | + | |V76|ALEVEN|Number of (契約口数) |
- | |V77|APERSONG|Number of private accident insurance policies| | + | |V77|APERSONG|Number of (契約口数) |
- | |V78|AGEZONG|Number of family accidents insurance policies| | + | |V78|AGEZONG|Number of (契約口数) |
- | |V79|AWAOREG|Number of disability insurance policies| | + | |V79|AWAOREG|Number of (契約口数) |
- | |V80|ABRAND|Number of fire policies| | + | |V80|ABRAND|Number of (契約口数) |
- | |V81|AZEILPL|Number of surfboard policies| | + | |V81|AZEILPL|Number of (契約口数) |
- | |V82|APLEZIER|Number of boat policies| | + | |V82|APLEZIER|Number of (契約口数) |
- | |V83|AFIETS|Number of bicycle policies| | + | |V83|AFIETS|Number of (契約口数) |
- | |V84|AINBOED|Number of property insurance policies| | + | |V84|AINBOED|Number of (契約口数) |
- | |V85|ABYSTAND|Number of social security insurance policies| | + | |V85|ABYSTAND|Number of (契約口数) |
- | |V86|CARAVAN Number of mobile home policies 0 - 1| | + | |V86|CARAVAN|Number of (契約口数) |
== 各変数のコーディング == | == 各変数のコーディング == | ||
行 451: | 行 470: | ||
tic.eval <- ticdata[5823: | tic.eval <- ticdata[5823: | ||
</ | </ | ||
- | |||
=== 準備 === | === 準備 === | ||