Site icon Stata.Professor : Your Partner in Research

Cluster Analysis/Grouping variables

Dear all, I am currently having some issues grouping some data from my dataset. The thing is that i'm trying to use Cluster Analysis with some of my variables to agroup them into 3 different groups (high innovation, medium innovation and low innovation companies) hierarchically ordered from high to low scores but im having some issues in the process since most of the scores resulted mixes. ¿How can I solve this? This is the do-file i am using to do so:
 clear all
ssc install asdoc
set mem 500m
use "C:\Users\PC Victor\Desktop\MCES\MODELO\STATA\BD_prueba1.dta", clear

putdocx begin

***** CLUSTER ******************
///////POR GRUPOS DE INNOVACIÓN///////
cluster singlelinkage IAIT IGIO IIET Utilidades Productividad Ingresosxhab, measure(L2) name(CLUS_PRUE1)
cluster generate CLUS_GR1 = groups(3), name(CLUS_PRUE1) ties(error)

cluster kmeans Utilidades Productividad  Ingresosxhab IAIT IGIO IIET, k(3) measure(L2) name(K_MEDIAS) start(krandom)
asdoc table K_MEDIAS , contents(freq mean Productividad mean Ingresosxhab mean Utilidades) dec(2), save(propuesta5)
asdoc table K_MEDIAS , contents(freq mean IAIT mean IGIO mean IIET ) dec(2), save(propuesta5)

cluster averagelinkage Utilidades Productividad Ingresosxhab IAIT IGIO IIET, measure(L2) name(clus_enlaceprom)
cluster generate clus_enlaceprom_grup = groups(3), name(clus_enlaceprom) ties(error)
asdoc table clus_enlaceprom_grup , contents(freq mean Productividad mean Ingresosxhab mean Utilidades ) dec(2), save(propuesta5)
asdoc table clus_enlaceprom_grup , contents(freq mean IAIT mean IGIO mean IIET ) dec(2), save(propuesta5)

cluster wardslinkage Utilidades Productividad Ingresosxhab IAIT IGIO IIET, measure(L2) name(CLU_ward)
cluster generate CLUSTER_WARD = groups(3), name(CLU_ward) ties(error)
asdoc table CLUSTER_WARD , contents(freq mean Utilidades mean Productividad mean Ingresosxhab ) dec(2), save(propuesta5)
asdoc table CLUSTER_WARD , contents(freq mean IAIT mean IGIO mean IIET) dec(2), save(propuesta5)

cluster singlelinkage IAIT IGIO IIET, measure(L2) name(clus_innov)
cluster generate CLUSTER_VAR_INNOV = groups(3), name(clus_innov) ties(error)
asdoc table CLUSTER_VAR_INNOV , contents(freq mean Utilidades mean Productividad mean Ingresosxhab) dec(2), save(propuesta5)
asdoc table CLUSTER_VAR_INNOV , contents(freq mean IAIT mean IGIO mean IIET) dec(2), save(propuesta5)


asdoc table CLUS_GR1, contents(freq mean Productividad mean Ingresosxhab mean Utilidades ) dec(2), save(propuesta5)
asdoc table CLUS_GR1, contents(freq mean IAIT mean IGIO mean IIET ) dec(2), save(propuesta5) 
I really appreciate any help you can provide. Thank you
Exit mobile version