Hello all,
How are you? I hope your week is going well!
Im conducting a k-medoids cluster analysis, using package clutils and command clpam. Im having some issues with my program. Here is a quick overview of my problem -
I have 26 waves (years) of data from the NLSY79 1979-2014. In each wave, a respondent (with person id "CASEID") has one status (and only one) from the following options -
1) Military
2) Education
3) Employment
4) Housework
5) Unemployment
6) Out of labor force (oolf)
Therefore, each respondent has a 26-year status sequence with no missing data.
Following Professor Halpin, the creator of package clutils, and his 2017 presentation on cluster analysis, I want to conduct k-medoids cluster analysis on Stata and sort all the consequences into five (5) distinct clusters, using clpam. My ideal clusters should be something like -
1) Lifetime military, including military all the way or military to further education (GI Bill) then back to military
2) Military to labor market without further education
3) Military to further education to the civilian labor market
4) labor market all the way without higher education
5) higher education to labor market.
My codes are -
sort CASEID
matrix dissim subcost = education military employment unemployment housekeeping oolf, variables matching dissim(oneminus) allbinary
matrix subA =subcost[1..6, 1..6]
clpam k5, dist(subcost) id(CASEID) medoids(5) many
However, an error message showed up, saying " variable CASEID does not uniquely identify the observation." If I understand the error correctly, I think it is because I have 26 waves, so the each CASEID shows up 26 times, and it does not uniquely identify the observation, which is true.
Im supposed to cluster the status sequences, not the individual status from each year. I dont think my code is doing what I want to accomplish.
If possible, would anyone please point me to the right direction?
Any help would be much appreciated!
Thank you very much!
Have a great day!
Rachelle
Related Posts with Question on Cluster Anlysis Partitioning Around Medoids (PAM) using clpam
How can I Make these code to loop code ?Hi. I want to make loop code of below. Code: gen A01_GLU0_new =. replace A01_GLU0_new = A01_GLU0_…
Plot confidence interval for linear mixed modelHi, I'm running a linear mixed model, and am now trying to plot a fitted line with a 95% CI for thi…
Controlling for confounders in t-testsHi all, I'm a little stuck on a paper looking at differences in fasting glucose levels between diff…
Set of error termsIf I want to create a set of error terms in a dataset. Can I just use the variable gen error = rnorm…
Aggregating variablesGood day everyone, I am still an undergrad student so please excuse any elementary questions. I am…
Subscribe to:
Post Comments (Atom)
0 Response to Question on Cluster Anlysis Partitioning Around Medoids (PAM) using clpam
Post a Comment