Announcement

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

  • #16
    Advice in #14 did not work!
    The code in #13 fails at the 3rd graph of the first level of gamblemeasurement (g=1) in the last loop. After removing the command for the 3rd graph from the loop, then the other two graphs are shown for all the levels of the gamblemeasurement (g=1, g=2, g=3, g=4 and g=5).

    Comment


    • #17
      Everywhere that you have

      Code:
      `riskg'
      I think it should be

      Code:
      risk`g'

      Comment


      • #18
        It does not work either. Then, I get an error message saying variable eqbidrisk1 not found, which is true. Variables eqbid, error, sqrerror, mse and rootmse are followed by a suffix from 1 to 100.
        Back to the initial code that I shared, the loop fails on finding the variable error`riskg' saying error ambiguous abbreviation. This is quite strange because the other two graphs with the variables eqbid`riskg' are correctly executed after removing the last graph with the variable error`riskg'.

        Comment


        • #19
          If you refer to

          Code:
          `riskg'
          there are two possibilities. Either the local macro riskg has been defined earlier and it is substituted at that place, or the local macro riskg is not defined and no text is substituted at that place.

          The code you show nowhere defines a local macro riskg either implicitly (as part of a loop) or explicitly (through a statement beginning local riskg

          Looking again at this code, here revised for clarity, my next guess is that every mention of `riskg' should be to `g'. But I am handicapped by the lack of a data example and by not knowing what code lies upstream of this.

          What is the result of
          levelsof gamble ?

          I am really guessing wildly as what is the point of calculating each risk`g' if you don't use it?



          Code:
          destring risk, replace ignore(rootmse)
          levelsof gamble, local(gamblemeasurement)
          foreach g in `gamblemeasurement' {
              generate risk`g'=risk if gamble==`g'
              twoway (scatter bid eqbid`riskg' if gamble==`g', sort) ///
              (lfit bid eqbid`riskg' if gamble==`g', sort), ytitle(Observed) xtitle(Predicted) name(ScatterGamble`g', replace)
          
              twoway (fpfit bid privatevalue if gamble==`g', lcolor(black)) ///
              (fpfit eqbid`riskg' privatevalue if gamble==`g', lcolor(red)), name(FittedGamble`g', replace)
          
              twoway (scatter error`riskg' eqbid`riskg' if gamble==`g', sort), ///
              ytitle (Error) xtitle(Predicted) name(DeviationsGamble`g', replace)
          }
          Last edited by Nick Cox; 11 Feb 2022, 09:36.

          Comment

          Working...
          X