Announcement

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

  • Ambiguous abbreviation Error in a simple loop

    Hey there, as student of political science, i have to make some regression analyses with Stata.
    For this matter, i want to run a loop with jackknife regressions. So far i got the following code:

    *Jackknife
    levelsof iso, local(iso)
    foreach i of local iso {
    display "regression without iso 'i"
    regress PolGen12_Diff8008 Instism5 GDPpcGoecd10 if iso != i }

    This should give me my jackknife regressions and display witch country was left out. But instead i got this:

    levelsof iso, local(iso)
    36 40 56 124 208 246 250 276 300 372 380 392 528 554 578 620 724 752 756 826 840

    . foreach i of local iso {
    2. display "regression without iso 'i"
    3. regress PolGen12_Diff8008 Instism5 GDPpcGoecd10 if iso != i }
    regression without iso 'i
    i ambiguous abbreviation

    Can anybody help me solve this? Thx

  • #2
    Try
    Code:
    levelsof iso, local(iso)
    foreach i of local iso {
        display "regression without iso 'i'"
        regress PolGen12_Diff8008 Instism5 GDPpcGoecd10 if iso  != `i'
    }
    Have you considered the something like the following?
    Code:
    regress PolGen12_Diff8008 Instism5 GDPpcGoecd10, vce(jackknife, cluster(iso))

    Comment


    • #3
      A slight typo in Joseph's code above.

      Code:
      levelsof iso, local(iso)
      foreach i of local iso {
          display "regression without iso `i'"
          regress PolGen12_Diff8008 Instism5 GDPpcGoecd10 if iso  != `i'
      }

      Comment


      • #4
        Please post non-Mata questions in General.

        Comment


        • #5
          Thank u guys, that works!
          @ Nick Cox sry i gonna post further questions in the mata directory!

          Comment

          Working...
          X