income.html
来自「本程序是基于linux系统下c++代码」· HTML 代码 · 共 126 行
HTML
126 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Income Data Set</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for Income {arules}"><tr><td>Income {arules}</td><td align="right">R Documentation</td></tr></table>
<h2>Income Data Set</h2>
<h3>Description</h3>
<p>
The <code>IncomeESL</code> data set originates from an example in the book
‘The Elements of Statistical Learning’ (see Section source). The data
set is an extract from this survey. It consists of 8993 instances (obtained
from the original data set with 9409 instances, by removing those
observations with the annual income missing) with 14 demographic attributes.
The data set is a good mixture of categorical and continuous variables with a
lot of missing data. This is characteristic of data mining applications.
The <code>Income</code> data set contains the data already prepared and coerced to
<code><a href="transactions-class.html">transactions</a></code>.
</p>
<h3>Usage</h3>
<pre>
data("Income")
data("IncomeESL")
</pre>
<h3>Format</h3>
<p>
<code>IncomeESL</code> is a data frame with 8993 observations on the
following 14 variables.
<dl>
<dt>income</dt><dd>an ordered factor with levels <code>[0,10)</code> < <code>[10,15)</code> < <code>[15,20)</code> < <code>[20,25)</code> < <code>[25,30)</code> < <code>[30,40)</code> < <code>[40,50)</code> < <code>[50,75)</code> < <code>75+</code></dd>
<dt>sex</dt><dd>a factor with levels <code>male</code> <code>female</code></dd>
<dt>marital status</dt><dd>a factor with levels <code>married</code> <code>cohabitation</code> <code>divorced</code> <code>widowed</code> <code>single</code></dd>
<dt>age</dt><dd>an ordered factor with levels <code>14-17</code> < <code>18-24</code> < <code>25-34</code> < <code>35-44</code> < <code>45-54</code> < <code>55-64</code> < <code>65+</code></dd>
<dt>education</dt><dd>an ordered factor with levels <code>grade <9</code> < <code>grades 9-11</code> < <code>high school graduate</code> < <code>college (1-3 years)</code> < <code>college graduate</code> < <code>graduate study</code></dd>
<dt>occupation</dt><dd>a factor with levels <code>professional/managerial</code> <code>sales</code> <code>laborer</code> <code>clerical/service</code> <code>homemaker</code> <code>student</code> <code>military</code> <code>retired</code> <code>unemployed</code></dd>
<dt>years in bay area</dt><dd>an ordered factor with levels <code><1</code> < <code>1-3</code> < <code>4-6</code> < <code>7-10</code> < <code>>10</code></dd>
<dt>dual incomes</dt><dd>a factor with levels <code>not married</code> <code>yes</code> <code>no</code></dd>
<dt>number in household</dt><dd>an ordered factor with levels <code>1</code> < <code>2</code> < <code>3</code> < <code>4</code> < <code>5</code> < <code>6</code> < <code>7</code> < <code>8</code> < <code>9+</code></dd>
<dt>number of children</dt><dd>an ordered factor with levels <code>0</code> < <code>1</code> < <code>2</code> < <code>3</code> < <code>4</code> < <code>5</code> < <code>6</code> < <code>7</code> < <code>8</code> < <code>9+</code></dd>
<dt>householder status</dt><dd>a factor with levels <code>own</code> <code>rent</code> <code>live with parents/family</code></dd>
<dt>type of home</dt><dd>a factor with levels <code>house</code> <code>condominium</code> <code>apartment</code> <code>mobile Home</code> <code>other</code></dd>
<dt>ethnic classification</dt><dd>a factor with levels <code>american indian</code> <code>asian</code> <code>black</code> <code>east indian</code> <code>hispanic</code> <code>pacific islander</code> <code>white</code> <code>other</code></dd>
<dt>language in home</dt><dd>a factor with levels <code>english</code> <code>spanish</code> <code>other</code></dd>
</dl>
<h3>Details</h3>
<p>
To create <code>Income</code> (the transactions object), the original data frame in
<code>IncomeESL</code> is prepared in a similar way as
described in ‘The Elements
of Statistical Learning.’ We
removed cases with missing values and
cut each ordinal variable (age, education,
income, years in bay area, number in household, and number of children)
at its median into two values (see Section examples).
</p>
<h3>Source</h3>
<p>
Impact Resources, Inc., Columbus, OH (1987).
</p>
<p>
Obtained from the web site of the book:
Hastie, T., Tibshirani, R. & Friedman, J. (2001)
<EM>The Elements of Statistical Learning</EM>.
Springer-Verlag.
(<a href="http://www-stat.stanford.edu/~tibs/ElemStatLearn/">http://www-stat.stanford.edu/~tibs/ElemStatLearn/</a>;
called ‘Marketing’)
</p>
<h3>Examples</h3>
<pre>
data("IncomeESL")
IncomeESL[1:3, ]
## remove incomplete cases
IncomeESL <- IncomeESL[complete.cases(IncomeESL), ]
## preparing the data set
IncomeESL[["income"]] <- factor((as.numeric(IncomeESL[["income"]]) > 6) +1,
levels = 1 : 2 , labels = c("$0-$40,000", "$40,000+"))
IncomeESL[["age"]] <- factor((as.numeric(IncomeESL[["age"]]) > 3) +1,
levels = 1 : 2 , labels = c("14-34", "35+"))
IncomeESL[["education"]] <- factor((as.numeric(IncomeESL[["education"]]) > 4) +1,
levels = 1 : 2 , labels = c("no college graduate", "college graduate"))
IncomeESL[["years in bay area"]] <- factor(
(as.numeric(IncomeESL[["years in bay area"]]) > 4) +1,
levels = 1 : 2 , labels = c("1-9", "10+"))
IncomeESL[["number in household"]] <- factor(
(as.numeric(IncomeESL[["number in household"]]) > 3) +1,
levels = 1 : 2 , labels = c("1", "2+"))
IncomeESL[["number of children"]] <- factor(
(as.numeric(IncomeESL[["number of children"]]) > 1) +0,
levels = 0 : 1 , labels = c("0", "1+"))
## creating transactions
Income <- as(IncomeESL, "transactions")
Income
</pre>
<hr><div align="center">[Package <em>arules</em> version 0.6-6 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?