Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MCA/ Joint CA: Combining scatterplot of observations with mcaplot

    Dear Statalist,

    this is a very reduced version of a much larger dataset:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id byte(f1 o3 o4 s1)
      1 1 1 0 0
      2 1 0 0 0
      3 1 0 0 0
      4 1 0 0 0
      5 1 0 0 0
      6 1 0 0 0
      7 1 0 0 0
      8 1 1 1 0
      9 1 0 0 0
     10 1 1 0 0
     11 1 1 1 1
     12 1 1 1 0
     13 1 1 1 0
     14 1 0 0 0
     15 1 0 0 0
     16 1 0 0 0
     17 1 0 0 0
     18 1 0 1 1
     19 1 0 0 0
     20 1 1 1 0
     21 1 0 0 0
     22 1 0 0 0
     23 1 0 0 0
     24 1 0 0 0
     25 1 1 0 0
     26 1 0 1 0
     27 1 0 1 0
     28 1 0 0 1
     29 1 0 1 0
     30 1 0 0 0
     31 1 0 0 0
     32 1 0 1 0
     33 1 1 1 0
     34 1 0 0 0
     35 1 1 1 0
     36 1 1 1 0
     37 1 0 0 0
     38 1 0 1 1
     39 1 0 0 0
     40 1 1 0 0
     41 1 1 1 0
     42 1 0 1 1
     43 1 0 0 0
     44 1 0 0 0
     45 1 1 0 0
     46 1 0 1 0
     47 1 0 0 0
     48 1 1 0 0
     49 1 1 1 0
     50 1 0 1 1
     51 1 1 1 0
     52 1 0 0 0
     53 1 0 1 0
     54 1 0 0 1
     55 1 1 1 0
     56 1 1 0 1
     57 1 0 0 1
     58 1 0 0 0
     59 1 1 0 1
     60 1 1 1 0
     61 1 0 1 1
     62 1 0 1 1
     63 1 1 0 1
     64 1 1 1 0
     65 1 1 1 1
     66 1 1 0 1
     67 1 1 1 0
     68 1 0 1 0
     69 1 1 1 1
     70 1 0 0 0
     71 1 1 0 0
     72 1 0 0 0
     73 1 0 0 0
     74 1 0 1 0
     75 1 0 0 0
     76 1 1 1 0
     77 1 0 0 0
     78 1 1 1 0
     79 1 1 0 0
     80 1 1 1 1
     81 1 1 0 0
     82 1 1 0 0
     83 1 0 1 0
     84 1 1 1 0
     85 1 1 1 0
     86 1 1 1 0
     87 1 0 0 0
     88 1 1 1 0
     89 1 0 0 0
     90 1 0 0 0
     91 1 1 0 1
     92 1 1 1 0
     93 1 1 0 0
     94 1 0 0 0
     95 1 1 0 1
     96 1 0 0 0
     97 1 0 1 0
     98 1 1 0 1
     99 1 0 0 0
    100 1 0 0 0
    end
    label values f1 f1ex
    label def f1ex 1 "vg", modify
    label values o3 o3
    label def o3 0 "nf", modify
    label def o3 1 "f", modify
    label values o4 o4
    label def o4 0 "nm", modify
    label def o4 1 "m", modify
    label values s1 s1
    label def s1 0 "nnaS", modify
    label def s1 1 "natS", modify
    I am performing joint correspondence analysis and visualise the results with mcaplot...
    Code:
    mca o3 o4 s1, supp(f1) method(joint)
    mcaplot, overlay  xline(0) yline(0) scale(.5) aspectratio(1) legend(off) mlabpos(12) msymbol(circle) mlabgap(2) name(mca)
    and a space of individuals / scatterplot of the observations:
    Code:
    predict a1 a2
    scatter a2 a1,  xline(0) yline(0) scale(.3) mlabel(id) name(scat)
    (it looks much less strange on my original dataset, I promise).

    What I would like to do now is to combine both graphs so that I have both the variables and observations in one plot, similar to what can be done with the factoextra package in R.
    But, e.g.
    Code:
    graph combine mca scat
    gives me two seperate graphs.

    Is it even possible to combine mca postestimation plots with a scatterplot?

    Best,
    Nadine

  • #2
    The mcaplot is itself a kind of scatter plot, so I don't know how that would work having another scatter plot overlaid. There may be a direct solution which I am not aware of, but here is a way to reconstruct the graph using twoway.

    https://www.statalist.org/forums/for...raph-after-mca

    Comment


    • #3
      Thank you, Andrew!
      I think I found a solution, I can enter the Case ID as a supplementary Variable to obtain the cloud of individuals. I am not yet sure the result is the same, though.

      Comment

      Working...
      X