group 9 assignment

Upload: tonmoy-banerjee

Post on 02-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Group 9 Assignment

    1/9

    DATA MINING AND BUSINESS INTELLIGENCE

    RFM AnalysisUsing R and R Studio

    Group 9

    Alok Simha 1!"# $%ath&&k $S 1' Sail&sh (uma% 1") S%&&nidhish N1)* S&sank Num+u%i 1""'

  • 8/9/2019 Group 9 Assignment

    2/9

    Introduction to RFM Analysis

    RFM is widely used by direct marketers of all types for selecting which customers to targetoffers to. The fundamental premise underlying RFM analysis is that customers who havepurchased recently, have made more purchases and have made larger purchases are morelikely to respond to your offering than other customers who have purchased less recently,less often and in smaller amounts. RFM analysis can also be used to target special offers towelcome new customers, encourage small purchasers to spend more, to reactivate lapsedcustomers, or encourage other marketing initiatives.

    RFM analysis uses information about customers past behavior that is easily tracked andreadily available. Recency is how long ago the customer last made a purchase. Frequency ishowmany purchases the customer has made sometimes within a specified time period, such asaverage number of purchases per year!. Monetary is total dollars spent by the customeragain,

    sometimes within a specified time period!.

    Methodology

    "! RFM is performed using R#tudio. This included the following steps in datapreparation$

    , %ntries with customer &' ( were removed as they were not part of theloyalty program and could not be uni)uely identified.

    , 'ata type conversion was performed for R, to identify the character valueas date.

    *! +nce RFM was done, clustering was performed using R'ataMiner.

    Results of RFM Analysis

  • 8/9/2019 Group 9 Assignment

    3/9

    Result of K-Mean Clustering

    Naming of Clusters

    Recency Fre)uency Monetary luster -ame ercentagecompositio

    n/igh 0ow /igh Heavy

    Spenders

    *".12

    /igh 0ow 0ow First

    ime

    "3.42

    0ow /igh /igh Churn 15."2

  • 8/9/2019 Group 9 Assignment

    4/9

    /igh /igh 0ow Shoppers *4.62

    Recommendations

    !" Heavy Spenders$ These are customers who spend heavily when they visit thestore. #tore cannot afford to lose them. are must be taken to retain the customersby providing them e7cellent customer service when they visit the store.

    *! First imers# The goal is to make these customers visit the store again. Thiscould be done by providing an e7cellent customer e7perience the first time. %nsurethere is direct marketing for special sales. %ncourage them to provide feedback.

    $" Churn# These customers are customers moving out of the store. They should beencouraged to come back to the store. The factors leading to churn could beanalysed. The purchase data of these customers could be analysed to sendpersonalised and dedicated offers.

    %" Shoppers# These are customers who are visiting the store regularly, though theymay not spend much. These are cash cows for the store and could be retained bydelivering value on every visit.Minor offers, discounts and e7cellent customer serviceare sure ways to retain and grow this cluster of customers.

    &imitations

    #ince the clustering was done through R, individual records belonging to each cluster couldnot be identified.

    R Code for RFM Analysis

    f 8 read.table9RFM.t7t9, header 8 F!: df ;< as.data.framecbinddf=,">,df=,*>,df=,1>!!

    : name ;< c9&'9,9'ate9,9?mount9!: namesdf! ;< name: df=,*> ;< as.'ateas.characterdf=,*>!,@2A2m2d@!: headdf!: start'ate ;< as.'ateB"664("("C,@2A2m2d@!: end'ate ;< as.'ateB"66D(4("C,@2A2m2d@!: df ;< get'ataFramedf,start'ate,end'ate!: headdf!: df" ;

  • 8/9/2019 Group 9 Assignment

    5/9

    : histdfEMonetary!

    Functions

    get'ataFrame ;G df ;< df=df=,t'ateol-ame>;8 end'ate,>GG Hremove the rows with the duplicated &'s, and assign the df to a new df.G newdf ;< df=Jduplicateddf=,t&'ol-ame>!,>GG H caculate the Recencydays! to the end'ate, the smaller days value means morerecent

    G Recency;,units89days9!!GG H add the 'ays column to the newdf data frameG newdf ;!,>GG H caculate the fre)uencyG fre ;< as.data.frametabledf=,t&'ol-ame>!!G Fre)uency ;< fre=,*>G newdf ;< cbindnewdf,Fre)uency!GG Hcaculate the Money per dealG m ;< as.data.frametapplydf=,t?mountol-ame>,df=,t&'ol-ame>,sum!!G Monetary ;< m=,">KFre)uencyG newdf ;< cbindnewdf,Monetary!GG returnnewdf!GG L: get&ndependent#core ;< functiondf,r8,f8,m8! G

    G if r;8( NN f;8( NN m;8(! returnG

  • 8/9/2019 Group 9 Assignment

    6/9

    G Horder and the scoreG df ;< df=orderdfERecency,

  • 8/9/2019 Group 9 Assignment

    7/9

    G H make sure the customer who have the same recency have the same scoreG s ;< r%ndG"G ifi;r Q s ;8 len!G foru in s$ len!G ifdf=r%nd,column>88df=u,column>!G score=u>;< rG LG p*8r=i>GG ifdimdf=p";dfERecency Q dfERecency;8p*,>!=">:(! df=p";dfERecency QdfERecency;8p*,>ERO#core 8 len < iG *G LGG HH scoring the Fre)uencyG len 8 lengthf!

    G FO#core ;< crep",lengthdf=,">!!!G df ;< cbinddf,FO#core!G fori in "$len!G ifi 88 "!G p"8(G LelseG p"8f=i!=">:(! df=p";dfEFre)uency QdfEFre)uency;8p*,>EFO#core 8 iG LG ifdimdf=f=len>;dfEFre)uency,>!=">:(! df=f=len>;dfEFre)uency,>EFO#core 8 lenG"

  • 8/9/2019 Group 9 Assignment

    8/9

    GG HH scoring the MonetaryG len 8 lengthm!G MO#core ;< crep",lengthdf=,">!!!G df ;< cbinddf,MO#core!G fori in "$len!G ifi 88 "!G p"8(G LelseG p"8m=i!=">:(! df=p";dfEMonetary QdfEMonetary;8p*,>EMO#core 8 iG LG ifdimdf=m=len>;dfEMonetary,>!=">:(! df=m=len>;dfEMonetary,>EMO#core 8 lenG"

    GG Horder the dataframe by RO#core, FO#core, and MO#core descG df ;< df=order;< dimtmpdf!=">GG LG if i88" Q U88"!G barplotc,col89lightblue9,names.arg8names!G elseG barplotc,col89lightblue9!G if U88"! titleylab8paste9F9,i!!G if i88"! titlemain8paste9R9,U!!GG LG

  • 8/9/2019 Group 9 Assignment

    9/9