Comments (6)
Nice; unfortunately for me the way I wrote gcollapse's internals requires a different set of functions for each of these things. Mainly copy/paste with small tweaks, but still.
from stata-gtools.
Mmm... Yes, I will implement rawsum. At this point, it bothers me that I have to keep noting "rawsum" is not implemented. It will only take a few minutes, but testing might take a bit longer.
I agree it's a good idea to add "rawstat" so you can pass a list of targets, for which weights will be ignored. I won't make it too smart, so it will be slightly slower than regular gcollapse, but it should certainly be much faster than doing it two gcollapses.
It won't take very long to implement either, but I'm rather busy this week. Perhaps after the weekend or during the next. Cheers!
from stata-gtools.
Great!
from stata-gtools.
I think having a general rawstat is a great idea, but I'm wondering about a corner case:
sysuse auto
collapse (sum) turn (rawsum) rawturn=turn [fw=foreign]
list
You'll notice that sum and rawsum give the same result, because rawsum also ignores cases where foreign==0 (i.e. zero weights).
It's something you won't expect unless you know the details about the implementation (that on an early step we exclude obs. where the weights are zero), so it's a bit troublesome (but also a problem of collapse in general)
from stata-gtools.
I see what you mean, but the only plausible workaround would involve very annoying additions to the internals. Perhaps a warning noting that observations with weights that are 0 or missing are excluded even for raw stats? "Obs with 0 or missing weights dropped for all stats (including raw)"? Something like that.
I mean, this is also a bit of a conceptual issue, right? Are 0 and missing weights "0" or are they indicating the observation should be dropped? If the latter, then the raw stat is the raw sum among observations with valid weights/that are not dropped/etc. If the former, then certainly it would be confusing.
To be honest I tend to think about it in terms of the former, but given how annoying it would be to bypass this restriction, I'll conveniently re-think my interpretation of weights.
from stata-gtools.
Agree with you. Did a quick commit to ftools that just does it the easy way. I think just adding a warning on the help file will suffice.
from stata-gtools.
Related Issues (20)
- gegen total vs. egen total HOT 6
- Could not load gtools_macosx_v3.plugin, error 9999 HOT 9
- gegen normalize does not realize that a new variable shall be created HOT 1
- gunique missing scalars when there are no observations
- gtools version of merge HOT 4
- gtools not installing on macos Stata 16 HOT 3
- Problem with -if- condition in several commands HOT 1
- Please update the benchmark using Stata 17. HOT 5
- gtools 1.8.1 not working *at all* with Stata MP 16.1 on MacOS 11.6 HOT 7
- Plugin download error when using "ssc install gtools" HOT 2
- the option cw in gcollapse is invalid. HOT 2
- Error r(111) in Stata MP 16.1 and SE 17.0, macOS Monterey HOT 4
- OSX plugin fails; move OSX Compilation to github
- gegen max does not properly evaluate string expressions HOT 2
- Error trying to copy gtop.sthlp in Stata 14 HOT 3
- Could not load gtools_macosx_v3.plugin, error 9999 HOT 17
- Some commands appear to ignore [w=weights] HOT 3
- Export results to word or excel HOT 4
- Wrong number of groups HOT 1
- Will greshape support strL variabes in the future? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stata-gtools.