Announcement

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

  • truncate independent variable only for regression

    Hello,
    I am trying to reproduce a model conducted in previous studies, and work from there forward. However, the regression of those papers do truncate two independent variables, both at (-1) and (1). The regression looks like; dependent-var independent-var (truncated) and [battery of control variables]

    My data looks like the following, stata-version; STATA 14. want to truncate TAXRISK TAXAVOID.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(TOBINQ TAXRISK TAXAVOID PTROAw VOL_PTROAw)
     534.9625         .          . -.02838538         .
     716.5151         .          . .002406625         .
     940.1655         .          .  .02955219         .
    1438.7303         .          .   .0464805         .
    1799.5825         .          .    .081883         .
    1524.2985  .2117158 -.05773715  .08523285 .21286123
    1292.2108 .18533356 -.11306289  .08704758  .3091128
     1531.971 1.6120528 -.16798247  .04276229 .21286123
    1917.7026 .15945534  -.1646288  .06368567 .21286123
    1816.2937 .12556152  -.1762948  .04258824 .21286123
     2008.303 .11273167  -.2057642  .03846694 .21286123
     2161.308 .09726332  -.1876211  .04787452 .34941465
    1716.2954 .15766433  -.3829571 -.02318152  .4452159
     1418.811  .5652186  -.4990783  .04112059 .29196942
    2139.8582 .23024587  -.5566085  .05063291 .21286123
     1443.271         .          . -.02707996         .
     1434.441         .          .  .02324767         .
     2794.025         .          .  .06039088         .
     2415.032         .          .  .03506268         .
      2956.32         .          .  .06606981         .
    end
    *edit: I actually mean for calculating the correlations... not the regression
    Last edited by Bhaloe Singh; 19 Dec 2019, 08:19.

  • #2
    Originally posted by Bhaloe Singh View Post
    Hello,
    I am trying to reproduce a model conducted in previous studies, and work from there forward. However, the regression of those papers do truncate two independent variables, both at (-1) and (1). The regression looks like; dependent-var independent-var (truncated) and [battery of control variables]

    My data looks like the following, stata-version; STATA 14. want to truncate TAXRISK TAXAVOID.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(TOBINQ TAXRISK TAXAVOID PTROAw VOL_PTROAw)
    534.9625 . . -.02838538 .
    716.5151 . . .002406625 .
    940.1655 . . .02955219 .
    1438.7303 . . .0464805 .
    1799.5825 . . .081883 .
    1524.2985 .2117158 -.05773715 .08523285 .21286123
    1292.2108 .18533356 -.11306289 .08704758 .3091128
    1531.971 1.6120528 -.16798247 .04276229 .21286123
    1917.7026 .15945534 -.1646288 .06368567 .21286123
    1816.2937 .12556152 -.1762948 .04258824 .21286123
    2008.303 .11273167 -.2057642 .03846694 .21286123
    2161.308 .09726332 -.1876211 .04787452 .34941465
    1716.2954 .15766433 -.3829571 -.02318152 .4452159
    1418.811 .5652186 -.4990783 .04112059 .29196942
    2139.8582 .23024587 -.5566085 .05063291 .21286123
    1443.271 . . -.02707996 .
    1434.441 . . .02324767 .
    2794.025 . . .06039088 .
    2415.032 . . .03506268 .
    2956.32 . . .06606981 .
    end
    *edit: I actually mean for calculating the correlations... not the regression
    Used the
    Code:
    regress var1 varN, if var1>-1 & varN <x if
    look alright...

    Comment


    • #3
      Originally posted by Bhaloe Singh View Post

      Used the
      Code:
      regress var1 varN, if var1>-1 & varN <x if
      look alright...
      The if condition you specified would truncate the data as you specified, if x was actually typed as 1. If you literally typed x, Stata would have looked for a variable x or a scalar x.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Originally posted by Weiwen Ng View Post

        The if condition you specified would truncate the data as you specified, if x was actually typed as 1. If you literally typed x, Stata would have looked for a variable x or a scalar x.
        Code:
         * Example generated by -dataex-. To install: ssc install dataex clear input long GVKEY int YEAR float TOBINQ double TAXRISK float(TAXAVOID PTROA) double VOL_PTROA float(VOL_PTROAxPTROA NOL LN_SALES LEVERAGE FOREIGN CAPEX SALES_GROWTH RnD ADVERTISING INTANGIBLES DEPRECIATION) 1004 2002  534.9625                  .          . -.02838538                   .           .         0 6.407436  .3741715 0 -.50949204         . 0 0 .07270969 -1.394151 1004 2003  716.5151                  .          . .002406625                   .           .         0  6.47998  .3553656 0   6.025776         . 0 0 .06734885  15.62976 1004 2004  940.1655                  .          .  .02955219                   .           . .08290154   6.6172  .3153435 0   .6022922         . 0 0   .064533 1.2916493 1004 2005 1438.7303                  .          .   .0464805                   .           . .03987254 6.799372  .3278083 0   .3581853  .4798437 0 0 .04780148  .6422982 1004 2006 1799.5825 .15885049600141204 -.03022778    .081883  .04203762053354467  .003442167         0 6.967126  .3070868 0   .3419201  .6276647 0 0 .07131477  .3683211 1004 2007 1524.2985 .07570619555800268  -.3732283  .08523285  .03517654717773287 .0029981975         0 7.233397  .3898004 0   .2613018  .8518723 0 0 .09630325  .3441527 1004 2008 1292.2108 .09505089557477771  -.4198036  .08704758  .02633732760474748 .0022926007         0 7.261208  .3314558 0  .22963247  .5869847 0 0 .10961437  .3381815 1004 2009  1531.971   .177512044024802  -.8315912  .04276229 .022080702062020632 .0009442215         0 7.209452 .29114708 0   .4495389  .2742089 0 0  .1128736  .6064997 1004 2010 1917.7026 .16705069979054202  -.8943772  .06368567 .018862056884024998 .0012012428         0 7.481996 .26053295 0  1.1509267 .28222805 0 0  .1062946  .5464918 1004 2011 1816.2937 .15083701978266853  -.9782713  .04258824 .021744429553470862  .000926057         0 7.637475   .360874 0   .9754997  .4568349 0 0 .19704115  .8590938 end format %ty YEAR
        But the strange thing is that without the truncating option I get a similar result as the one from the studies I am reproducing.

        Comment

        Working...
        X