Dear Stata users,
I performed the K-means clustering analysis on stock market cash-flow and discount-rate betas. To visualize my results I created the scatterplot which 7 different groups. How can I transform my graph so I can exactly know which stocks are in each cluster? (Instead of getting differently coloured points). Here the code I used:
graph twoway (scatter beta_cf beta_dr if k7r == 1, mcolor(orange)) (scatter beta_cf beta_dr if k7r== 2, mcolor(green) ) (scatter beta_cf beta_dr if k7r == 3,mcolor(blue)) (scatter beta_cf beta_dr if k7r == 4, mcolor(red)) (scatter beta_cf beta_dr if k7r == 5, mcolor(purple)) (scatter beta_cf beta_dr if k7r == 6, mcolor(darkgreen)) (scatter beta_cf beta_dr if k7r == 7, mcolor(cranberry)), legend(label(1 "cluster1") label(2 "cluster2") label(3 "cluster3") label(4 "cluster4") label(5 "cluster5") label(6 "cluster6") label(7 "cluster7"))
Any help would be much appreciated!
Related Posts with K-means clustering
Grouping Columns using esttab and export .rtf file - helpHello is there a way to group different regression using esttab and not exporting to latex. I would …
Dependent binary variable with relative frequiencies of 5% and 95%I have a binary dependent variable with the following frequency distribution: Yes (1128) and No (240…
Times series plotHi, I’m trying to create a time series plot with the data below. I´m trying to create one plot for …
Generate age in paneldataHi I have already the birthday but I will like to create a birth-year. How can I do that? …
Discrete choice latent class model with blocking of choice setsI am trying to run a latent class model using the gsem command in Stata 16.1 I have 7 attributes of …
Subscribe to:
Post Comments (Atom)
0 Response to K-means clustering
Post a Comment