Announcement

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

  • #16
    Responding to #14: I can't replicate your problem in the example data. If I run
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(id imp p_imp)
    100018  5  1
    100019  1  5
    100023 10 10
    100024 10 10
    100029  5  1
    100030  1  5
    100038  5  0
    100039  0  5
    100042  2  4
    100043  4  2
    100048 -8 -8
    100049 -8 -8
    100052  2  7
    100053  7  2
    100055 -8  3
    100057  3  1
    end
    
    foreach var of varlist _all {
        replace `var' = . if `var' < 0
    }
    
    graph twoway scatter p_imp imp
    I get a graph with no negative values of either variable.

    Comment


    • #17
      Thanks Carlo Lazzaro. Wouldn't I need to also state that imp>0? Well in this case as '0' is at the lowest end of the Likert scale I think >=0 is better (I've also included some restrictions, ... thoughts?:
      Code:
      twoway scatter limp p_imp in 40/1500 if imp>=0 & p_imp>=0 & married==1 & wave==4 , legend(cols(1)) scheme(vg.s2c) ytitle(scale (0-10)) title(Importance (married), size(medsmall)) ylabel(0(1)10) xtitle(scale (0-10)) xlabel(0(1)10) name(Import_if_marr_w4, replace)
      Do you know any other graph types I could potentially use?

      Comment


      • #18
        Chris:
        1) I share your point (-if imp>=0- sounds better than -if imp>0-);
        2) sorry, I do not know other graphs.
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #19
          The question of other graphs was raised and answered in your concurrent thread: https://www.statalist.org/forums/for...-their-partner

          See again the post of Maarten Buis and its links.

          Comment


          • #20
            Thanks Carlo Lazzaro and Nick Cox.

            Comment


            • #21
              I will be grateful if you could advance my understanding of the double hurdle model in relation to how to estimate the elasticities of explanatory variables the marginal effects of explanatory variables can be used to calculate elasticities for the probability of a positive expenditure, the conditional level of expenditure and the unconditional level of expenditure. Upon reading John Eakins’ (2016) work: An Application of the double hurdle model to petrol and diesel household expenditure in Ireland, it was fairly easy for me to decide on the appropriate specification for my dataset. However, I am unable to estimate the elasticities and is soliciting support. Any written commands will be deeply appreciated. I can send my data and dofile, if they are needed. Thanks.

              Comment


              • #22
                #21 has nothing whatsoever to do with the topic of this thread. Statalist posts are not a dialog between questioner and responder, though it is easy to misunderstand it that way. Other people come to the forum and search for answers to their questions. When extraneous matters are added to an existing thread, they waste the time of those who find the thread in a search for an answer to the question in the thread's topic, and they are unfindable by others who might be searching for answers to the off-topic question. So, to maximize the value of this Forum to everyone, it is important to keep threads on topic.

                Please repost this question as a New Topic (or, if there is an existing thread on this same topic, add it there.)

                Comment


                • #23
                  Hi Clyde Schechter, further to your comment at #16, I re-ran my code and found that it has now removed the negative (non-response) values. Thank you again.

                  Comment


                  • #24
                    Originally posted by Clyde Schechter View Post
                    Often when people on this forum say they want to "drop" certain values of variables, it turns out that they mean they want to replace those values with the system missing value (dot). If that's what is meant here:

                    Code:
                    foreach v of varlist _all {
                    replace `v' = . if `v' < 0
                    }
                    I have the same issue, trying to change the negative values in my observations with missing dots; however the code leads to an "unexpected end of file" error for me. Could you guys help me here?

                    Comment


                    • #25
                      You may need to ensure a carriage return/line feed at the end of a do-file or do-file editor contents.

                      Comment


                      • #26
                        Zangeasd:
                        works for me in the following toy-example:
                        Code:
                        . set obs 3
                        Number of observations (_N) was 0, now 3.
                        
                        . g A=-2 in 1
                        
                        . replace A=_n if A==.
                        
                        . g B=-4 in 3
                        
                        . replace B=_n if B==.
                        
                        . list
                        
                             +---------+
                             |  A    B |
                             |---------|
                          1. | -2    1 |
                          2. |  2    2 |
                          3. |  3   -4 |
                             +---------+
                        
                        . foreach v of varlist _all {
                          2. replace `v' = . if `v' < 0
                          3. }
                        
                        
                        . list
                        
                             +-------+
                             | A   B |
                             |-------|
                          1. | .   1 |
                          2. | 2   2 |
                          3. | 3   . |
                             +-------+
                        
                        .
                        Kind regards,
                        Carlo
                        (Stata 18.0 SE)

                        Comment

                        Working...
                        X