GithubHelp home page GithubHelp logo

Comments (6)

mcaceresb avatar mcaceresb commented on May 26, 2024 1

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.

mcaceresb avatar mcaceresb commented on May 26, 2024

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.

Danferno avatar Danferno commented on May 26, 2024

Great!

from stata-gtools.

sergiocorreia avatar sergiocorreia commented on May 26, 2024

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.

mcaceresb avatar mcaceresb commented on May 26, 2024

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.

sergiocorreia avatar sergiocorreia commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.