Announcement

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

  • Frequency weight in a before and after graph (twoway pccapsym)

    Hi.

    I have a data set where I look at number of events before and after a certain time-point. I want to show this in a before and after graph with different colors for each group. I came a long way using twoway pccapsym. However, many of the observations have the same number of events before and after and therefore lines are overlaping. I am looking for a way to visualize how many observations that are overlapping. I thought I might use frequency weight. But I can not figure out how to use it in a graph made by twoway pccapsym.
    In this context, I can't figure out how to make variables that contains the weight information for before and after and add that information to a graph where markers (dots) and/or lines are weighted according to frequency

    Small example of data set:
    id Group before after
    1 2 0 2
    2 1 3 1
    3 3 2 2
    4 2 2 2
    5 3 1 3
    6 1 1 3
    7 1 3 3
    In the picture you can see how my graph (w. all data) looks without frequency weight. An example of the code for the graph is:

    gen byte one = 1
    gen byte two = 2
    twoway (pccapsym before one after two if group == 1) (pccapsym before one after two if group == 2) (pccapsym before one after two if group == 3)



    Click image for larger version

Name:	Skærmbillede 2020-02-27 kl. 15.04.51.png
Views:	1
Size:	223.5 KB
ID:	1538723

    I hope you can help me?

    Thanx

Working...
X