asjadnaqvi / stata-alluvial

A Stata package for alluvial plots
MIT License
5 stars 3 forks source link

Allow frequency weights #3

Closed mkaulisch closed 1 year ago

mkaulisch commented 1 year ago

I often work with data that is collapsed. It would be cool if frequency weights and/or importance weights would be allowed. The latter because sometimes I use frequencies with decimal numbers.

asjadnaqvi commented 1 year ago

that should be easy to add. if you can share a basic example of data with and without weights, i can implement it fairly fast.

mkaulisch commented 1 year ago

Have a look at this code example - from Discord channel

cwf default cap frame drop test frame create test cwf test

**# expand to use with alluvial expand impact_p, gen(expand_i)

**# separate field-Variable separate field, by(period) gen(pubs_) veryshortlabel sequential

alluvial pubs_1 pubs_2 pubs_3

mkaulisch commented 1 year ago

This code also generates an error code

PS: @asjadnaqvi has explained that the data in the form shown in this post: https://github.com/asjadnaqvi/stata-alluvial/issues/3#issuecomment-1382356172 - is not correct - and the error is correct.

asjadnaqvi commented 1 year ago

Weights added in v1.1 but need further testing.