EC_patient: Assign Patients to Economic Clusters

View source: R/EC_patient.R

EC_patientR Documentation

Assign Patients to Economic Clusters

Description

Function 'EC_patient' assigns patients in your study or registry to an economic cluster, as defined by the 'EconomicClusters' algorithm, based on the similarity of patients' assets to the assets of the cluster medoids.

Usage

EC_patient(Pts, Medoids, Pop, PopClusters)

Arguments

Pts

a data frame with columns consisting of patients' responses to the economic variables that define your economic model, with column names specified

Medoids

a data frame with columns consisting of cluster medoids' responses to the economic variables that define your economic model, with column names specified (as produced by function 'EconomicClusters')

Pop

a data frame with columns consisting of the DHS population's responses to the economic variables that define your economic model, with column names specified and equivalent to the column names and order of columns of 'Pts', as generated by 'EconomicClusters'

PopClusters

a vector listing the cluster membership of each household in the DHS population, as generated by 'EconomicClusters'

Details

'EC_patient' determines the distance between each patient and each cluster medoid using function 'daisy' from package 'cluster' with metric = "gower". See 'daisy' help files for further details. In the context of clustering algorithms, "distance" refers to how dissimilar two observations are based on their responses to a set of variables. 'EC_patient' assigns each patient to a cluster by the smallest distance from that patient to a cluster medoid.

If a patient is equidistant from the medoids of two or more clusters, 'EC_patient' will determine whether this individual shares the same asset profile as observations in the overall DHS population dataset. If so, and if all DHS observations with that asset profile were assigned to the same cluster by 'EconomicClusters', then that patient will be assigned to that cluster.

Value

A vector of cluster membership (denoted by the row index of the cluster medoid) for each patient

Author(s)

Lauren Eyler economic.clusters@gmail.com

See Also

EconomicClusters, Pts, Medoids

Examples

#We previously defined an economic clustering model for our population using 'EconomicClusters'.
#We saved a data frame containing the responses to the economic questions 
#selected by the model for the cluster medoids as Medoids.
#We saved a data frame consisting of the DHS population's responses to the economic questions
#selected by the model as Pop.
#We saved a vector of the cluster membership of each DHS observation as PopClusters.
#We have since collected trauma registry data for 250 patients 
#and asked them the 5 economic questions selected by the model.
#Data set Pts contains the new patients' responses to these five questions.
#We now want to know which economic cluster each patient belongs in.

data(Pts)
data(Medoids)
data(Pop)
data(PopClusters)
Pt_clust<-EC_patient(Pts, Medoids, Pop, PopClusters)
#number of patients per cluster:
table(Pt_clust)

#We now have a vector of patient cluster membership.

Lauren-Eyler/EconomicClusters documentation built on March 22, 2022, 1:21 a.m.