Announcement

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

  • danishussalam
    replied
    Originally posted by daniel klein View Post

    How is that "wrong"? If one of the values in a total is missing (i.e., unknown), then, mathematically, the result must be misssing (i.e., unknown), too. That might not be the result that you want for whatever reason but there is certainly nothing "wrong" about it.
    Yes - You are right. It is indeed correct mathematically. My suggestion was more about the command ignoring missing values and add what's left.

    Leave a comment:


  • daniel klein
    replied
    Originally posted by danishussalam View Post
    - simple addition by gen give missing(.) if one of the five is missing which is also wrong.
    How is that "wrong"? If one of the values in a total is missing (i.e., unknown), then, mathematically, the result must be misssing (i.e., unknown), too. That might not be the result that you want for whatever reason but there is certainly nothing "wrong" about it.

    Edit:

    btw. egen's rowtotal() has a missing option that does what you want. Note however that replacing missing values with 0 in some cases (at least one non-missing missing value in a row) but not in others (all values missing in a row) is inconsistent behavior; of all possible results, I would say what you want (and what the missing option provides) is actually closest to what I would deem "wrong".


    Edit was written in parallel to #373 and #375 below.
    Last edited by daniel klein; 26 Oct 2020, 07:53.

    Leave a comment:


  • danishussalam
    replied
    It would be nice to have a command that is superior to simple addition by gen and rowtotal by egen.

    If i add five variables with some of those variables having missing values.

    - egen with rowtotal gives 0 if all variables are missing which obviously is wrong, it should be missing.
    - simple addition by gen give missing(.) if one of the five is missing which is also wrong.

    Maybe there is a fix already which I am not aware of.

    Leave a comment:


  • Nick Cox
    replied
    John Mullahy Your suggestion is clear and beyond #368 most of my thoughts run on doing very loosely similar things in very different ways, e.g. convex hulls

    https://www.statalist.org/forums/for...-scatter-plots

    or polar smoothing

    https://www.stata-journal.com/articl...article=gr0021

    Leave a comment:


  • John Mullahy
    replied
    #368 Thanks Nick Cox . While my reply should perhaps be a separate topic instead of a Wishlist entry, i'll just note a different workaround I used based on twoway's scatteri.
    Code:
    cap preserve
    cap drop _all
    sysuse auto
    tw (scatter price mpg, legend(off)) (scatteri 4400 34.5, msym(oh) msi(*15) mlw(*1) mlc(red))
    cap restore
    Last edited by John Mullahy; 23 Oct 2020, 07:03. Reason: typo

    Leave a comment:


  • Nick Cox
    replied
    #364 John Mullahy While you're waiting for StataCorp https://www.stata-journal.com/articl...article=gr0010 explains how to draw your own circles. A generalisation is something like this -- assuming input of three numbers to a do-file that are the coordinates of the centre and the radius.


    Code:
    args yc xc rad 
    
    local min = `xc' - `rad'
    local max = `xc' + `rad'
    
    c_local call function `yc' + sqrt((`rad'^2) - (x - (`xc'))^2), ra(`min' `max') lc(black) || function `yc' - sqrt((`rad'^2) - (x - (`xc'))^2), ra(`min' `max') lc(black)
    Naturally I have no quarrel with anyone preferring to think of the centre as being at (xc, yc).

    This code pushes back the code in the bottom line back to the calling program as a local macro in the caller space, so that it can be included in some other syntax. Circles will only appear as circles with equal scales on both axes.

    Leave a comment:


  • Sergiy Radyakin
    replied
    Dear Chinh Nguyen,

    thank you very much! I hope other Stata users will find this suggestion useful too!

    Best, Sergiy

    Leave a comment:


  • Chinh Nguyen (StataCorp)
    replied
    Originally posted by Sergiy Radyakin View Post
    It would be good to have block-comment folding in the do-editor for
    Code:
    /*
    the
    multiline
    style
    */
    comments.
    We'll try to get that into a future update.

    Leave a comment:


  • Sergiy Radyakin
    replied
    It would be good to have block-comment folding in the do-editor for
    Code:
    /*
    the 
    multiline
    style
    */
    comments.

    I commonly comment-out whole blocks of code and folding them away is useful while testing large files. Currently the procedure/program definition can be folded away, but not when it is inside a comment.

    Leave a comment:


  • John Mullahy
    replied
    It would be useful if -twoway- offered an option to draw circles with specified characteristics at specified locations, along the lines of twoway's text(...) option. E.g., one might wish to highlight a particular set of observations in a scatter diagram. For instance
    Code:
    local yc=5
    local xc=2
    local cr=.5
    twoway scatter y x, ... circle(`yc' `xc' `cr', lcol(red) lwidth(*2)) ...
    where yc and xc are the y and x coordinates of the circle's center and cr is its radius.

    Leave a comment:


  • Joro Kolev
    replied
    Why is -nlsur- not accepting factor variables?

    This needs to be fixed.

    As -nlsur- stands now, one cannot use margins after it.

    Leave a comment:


  • Sergiy Radyakin
    replied
    I would like to second John Mullahy's suggestion here to add zoom capability to the output window.
    In OS MS Windows the standard approach is to use the Ctrl+MouseWheel to zoom in and out.
    Such zoom has been added recently to the code editor, but is still absent from the output/results window and the viewer/help window.

    Until this is added, the workaround that I am using is to produce the output with a small font setting (which prevents the tables in output from wrapping), then change the font temporarily for a zoom effect. Unfortunately the horizontal scroll bar does not appear (in Stata 16.0) so any content that doesn't fit into the screen can't be reached (panned to).

    Thank you, Sergiy

    Leave a comment:


  • Fahad Mirza
    replied
    While using grmap, i feel that the graph editor should have the ability to let people zoom and choose graph size from options. Further, it will be very useful to allow the option of adding leader text and diagrams to map locations which makes visualization less crammed in spaces where districts/small regions are close by.

    Similarly, the ability to add gradient colors on scatter plots (or any plot for that matter) will be very useful in visually displaying content. I see posts #2 and #3 are also referring to same concepts.

    Leave a comment:


  • wbuchanan
    replied
    John Mullahy
    Along the lines of what you are requesting, I think it could be handled more efficiently/effectively if it were possible to map aesthetic attributes to data values. In that case, your example above could potentially be created like;

    Code:
    qui: g str6 color = cond(x < 5, “blue”, “orange”)
    qui: g str1 shape = cond(x < 5, “d”, “o”)
    tw scatter y x if x < 10, mcol(color) msym(shape)
    Since the purpose of using colors/shapes in visualizations is to encode information present in the data visually, it seems logical/reasonable for StataCorp to handle the aesthetic properties of the glyphs/marks in a way that is consistent with the way positions are handled (e.g., by mapping values in the data and/or computation to the visual representation).

    That all said, I imagine this would require a non-trivial amount of effort to accomplish but would also make the data visualization capabilities much more comparable to capabilities in other software (e.g, Tableau, ggplot2, D3.js, Qlick, PowerBI, etc...).

    Leave a comment:


  • John Mullahy
    replied
    re: #358 Thanks Nick. I was not aware of -sepscatter- which I see can be helpful in some instances.

    I thought my request was a longshot in any event, and I suppose I can appreciate your reservations. But I'm wondering if those reservations would be any different were a new nomenclature implemented, e.g.
    Code:
    twoway scatter y x if x<10, mcol(blue when x<5, orange when x>=5) msym(d when x<5, o when x>=5)
    or whether there's a more fundamental concern given the way -twoway- options operate.

    Leave a comment:

Working...
X