Learn R Programming

arules (version 0.2-6)

random.transactions: Create a Random Transaction Data Set

Description

Creates a random transactions object where all items occur independently of each other.

Usage

random.transactions(nitems, ntrans, prob = 0.1)

Arguments

nitems
"integer"; number of items.
ntrans
"integer"; number of transactions.
prob
"numeric"; occurrence probabilities for items in the transactions. If prob is a vector of length nitems, each value is interpreted as the occurrence probability of the corresponding item. If prob

Value

Details

The function generates a nitems times ntrans transaction database. All items are treated as independent. Each transaction is the result of nitems independent Bernoulli trials, one for each item with success probabilities given by prob.

References

Michael Hahsler, Kurt Hornik, and Thomas Reutterer. Implications of probabilistic data modeling for mining association rules. In Proceedings of the 29th Annual Conference of the Gesellschaft fuer Klassifikation e.V., University of Magdeburg, March 9-11, 2005, Studies in Classification, Data Analysis, and Knowledge Organization. Springer-Verlag, 2005. Accepted for publication.

See Also

transactions-class.

Examples

Run this code
# generate random 1000 transactions for 200 items with 
 # a success probability decreasing from 0.2 to 0.0001
 trans <- random.transactions(200, 1000, seq(0.2,0.0001, length=200))
 
 # display random data set
 image(trans)

Run the code above in your browser using DataLab