runEM: Run an EM algorithm to obtain a mixture of binomial with K...

Description Usage Arguments Value Examples

View source: R/runEM.R

Description

This function is the main function of this package. The objective is to provide a clustering of the 80 campaigns that we have on our dataset. The specification of this algorithm is that we can have longitudinal data, i.e n observations for a single campaign.

Usage

1
runEM(formula, var_weights, K, df, col_id = "id")

Arguments

formula

A formula or Character which links target variable and predictor variables

var_weights

A character value corresponding to the weights variable

K

A numeric value representing the number of clusters chosen for the mixture

df

A dataframe to cluster

col_id

A character value (colname) corresponding to the id column name

Value

a summary list of EM algorithm results : loglikelihood, beta/lambda/tau estimation at each iteration, bic/icl value,number of fisher iteration at each EM iteration

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Load data :
data(adcampaign)
## Run mixture :
## Not run: 
result_mixture<-runEM(formula="ctr~timeSlot",
                      var_weights="impressions",
                      K=2,
                      df=adcampaign,
                      col_id="id")
## Analysis of results :
plot(result_mixture[[1]],type="l") #gives you the loglikelihood evolution
# list of the estimated parameter for each cluster for each iteration :
result_mixture[[2]]  
# list of the estimated parameter for each cluster for each iteration
result_mixture[[3]] #list of ids proportion in each cluster for each iteration
#list of matrices containing probability to be in cluster k for each id :
result_mixture[[4]] 
# BIC value :
result_mixture[[5]] 
# ICL value :
result_mixture[[6]] 
# list of number fisher scoring iterations for each iteration
result_mixture[[7]]

## End(Not run) 

binomialMix documentation built on March 23, 2020, 5:09 p.m.