Announcement

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

  • save lincom results

    Hi everyone,
    I'd like to if there is the possobility to store somewhere or to send to excel (for example with putexcel) the results of the command lincom.
    I used lincom within a loop which produces many and many results so I need to put them toghether.
    Is it possible?
    Last and least: how can I send to excel the scalar variables?
    many tks

  • #2
    Francy,

    This should be enough to get you started.

    Code:
    sysuse auto
    reg price mpg
    lincom mpg
    putexcel A1=(r(df)) using junk.xlsx, replace

    Comment


    • #3
      ok. I understan.
      But, what if I want to store confidence intervals and p-values?

      Comment


      • #4
        all of that can be found in r(table):
        Code:
        sysuse auto
        regress price mpg foreign
        mat li r(table)
        and use standard Stata functions to get what you want (e.g., help matrix_functions)

        Comment


        • #5
          OK but lincom doesn't produce r(table). Maybe I have to use lincomest ???

          Comment


          • #6
            sorry for misreading - however, lincom does give you the df (r(df)), the standard error (r(se)) and the estimate (r(estimate)) so you can use those along with the correct distributional function (see help density_functions)

            Comment


            • #7
              Yes... maybe I hve to give up... this is the only solution.
              I also tried this code that worked well:

              forvalues x=2005/2012 {
              quietly xtfrontier TC Q1 Q2 Q3 P1 P2 E Q1Q1 Q1Q2 Q1Q3 Q2Q2 Q2Q3 Q3Q3 P1P1 P1P2 P2P2 EE P1Q1 P1Q2 P1Q3 P2Q1 P2Q2 P2Q3 P1E P2E Q1E Q2E Q3E LNGDPCAP LNMKCAP LNPUBDEBT, tvd cost nonrtolerance
              lincomest _b[Q1]+_b[Q2]+_b[Q3]+_b[Q1Q1]*Q1m`x'+_b[Q1Q2]*Q1m`x'+_b[Q1Q3]*Q1m`x'+_b[Q2Q2]*Q2m`x'+_b[Q2Q3]*Q2m`x'+_b[Q3Q3]*Q3m`x'+_b[Q1Q2]*Q2m`x'+_b[Q1Q3]*Q3m`x'+_b[Q2Q3]*Q3m`x'+_b[P1Q1]*P1m`x'+_b[P1Q2]*P1m`x'+_b[P1Q3]*P1m`x'+_b[P2Q1]*P2m`x'+_b[P2Q2]*P2m`x'+_b[P2Q3]*P2m`x'+_b[Q1E]*Em`x'+_b[Q2E]*Em`x'+_b[Q3E]*Em`x'
              matrix sy`x' = r(table)
              matrix colnames sy`x' = `x'
              }
              matrix scaleyear = sy2005,sy2006,sy2007,sy2008,sy2009,sy2010,sy2011,s y2012

              ...but the estimation procedure takes a lot of time every loop...

              Comment

              Working...
              X