Quantcast
Channel: Statalist
Viewing all 72862 articles
Browse latest View live

Data Cleaning

$
0
0
I have a variable service_number. I know it HAS TO have 10 characters. How can I generate an indicator for all the observations for which service_number != 10. Also, how can I delete these observations in one command?

Recursive regression with fixed training window

$
0
0
Dear All,

Once again I am encountering some specific regression which cannot correctly execute. The idea is, lets say we have time series sample 1930-2010, we split this sample at 1980 and use prior observations as a fixed window, t=49, {1,...,t} and run regression on some variable lets say. At year 1980, we start running recursive regressions and using this window as base, thus now we run regression with {1,..,t+1} and so on until we exhaust all the remaining time series, until 2010, i.e {1,..,t+1},..,{1,..,t+30}. Maybe someone has some ideas or had similar issue?

Thank you in advance!
Marijus

Detrending in a Poisson Panel Model with many 0s in earlier years

Estimating first order autoregressive cost efficiency using "sftfe"

$
0
0
Hi,
I am trying to estimate first order autoregressive cost efficiency using "sftfe" - a stata command introduced by Bellotti and Ilardi. I am using a panel data with n= 70 and t = 21. I have tried several model specifications for this purpose but every time I am having either of the following two types of messages. Am I doing something wrong or missing something? Can anybody kindly explain to me what is going on and how can I fix this issue? I am using the following command

sftfe y x1 x2 time, est(pde) dist(hn) dynamic usigma(z1) rescale cost

Message type 1:

Iteration 14: Criterion function = -6511.1211 (not concave)
Iteration 15: Criterion function = -6511.1211
panelsubmatrix(): 3301 subscript invalid
_sftfe_Get_SoL_and_PoSt_ReS(): - function returned error
_sftfe_sf_est_ml(): - function returned error
<istmt>: - function returned error

Message type 2:

Iteration 12: Criterion function = -9187.6225 (not concave)
numerical derivatives are approximate
flat or discontinuous region encountered

I will really appreciate any help in this regard.
Thanks,
Aditi

Detrending in a Poisson Panel Model with many zeros in earlier years

$
0
0
Hello Stata community,
I have a panel data set of regions within a country and regress the mortality rate due to drug abuse (deaths per 100,000) on the unemployment rate. For the moment I use a log-linear model with the following stata code:
Code:
reg ln(mortality) unemployment controls i.year region##c.year [iw=region_population], vce(cluster region)
So far, so good (I hope). Now I want to results by age and sex. However, this is somewhat difficult because by slicing my sample into different sub-groups by age and sex I create some sub-groups with some 0s. Thus my idea to use a Poisson model for the analysis of these sub-groups, something along the lines of:
Code:
ppml mortality unemployment controls year_dummies region_dummies region_trends [iw=region_population] ,cluster(region)
(I hard code the dummies this time so ppml can work better with them).

So far this is very straight forward. But I think there might be a problem with the linear trend specification because most of the 0s in the mortality data happen to be in earlier years before the trend lifts them up. Thus, I think a linear trend might not be a good approximation for the mortality data per sub-group due to the 0s. In other words, there is no trend (or seasonality for that matter) as long as mortality is equal to 0 but, as soon as mortality takes up the first positive value, it exhibits a linear trend.

Do you have any recommendations of what to do in such a case? Should I just use a non-linear detrending method before running the regression, eg. a Hodrick-Prescott filter (although Hamilton says we should never use one)?

Any suggestions would be much appreciated
Thanks,
Max

Repeated cross-sectional data analysis in stata

$
0
0
Please I need some help. I am looking at repeated cross-sectional individual data in which different sample of individuals have been surveyed (for the same data) over time. I want to look at how age, gender, disability, income and other factors predict the "medication use" over time. "Medication use" is a binary variable. What regression command in stata should I use. Thank you.

Selecting different time-periods OLS panel regression

$
0
0
Hello everybody,

This is my first time using both Stata and this forum so I'm a rookie regarding this program. I'm investigating certain variables pre, during and post economical crisis of 2007. For this I have a sample of around 2000 companies with 7 variables during 2005 until 2015. Now I have successfully ran an OLS Pooled Regression for the time period of 2005-2015 (All years). I wonder if there is a fast command to divide this in 3 time periods: 2005-2007, 2008-2011, 2012-2015. I thus need three OLS Pooled Regressions instead of one. I can of course manually prepare my data in excel separately for those three time periods, however I wonder if it is possible to do it in a quicker way through Stata.

Edit: After posting this question I forgot to tell that it might also be useful for my research to have OLS Pooled regressions for each year individually as well. Thus the same question but than individually per year. This means 10 individual OLS Regressions and 3 time-period OLS Regressions.

Thank you very much,

Vincent van der Stee

Can Diff-in-diff be used with IPTW?

$
0
0
Hi!

I am desperate for answers to this question!! Is it possible to incorporate IPTW with Diff-in-Diff?

Many thanks!!

Data Cleaning

$
0
0
I have a data set of around more than 5000 unique phone numbers. How can I randomly split this into 25 parts and extract 25 excel files with the same?

Generate a Dummy variable with group

$
0
0
Hello my data has 2 variables. I want to generate a dummy variable if there is something in A (=1) and nothing in A(=0) within the group B. my data looks like this (with how I want my dummy generated).
A B Dummy
Tom Group1 1
Group1 1
Group2 0
Carl Group3 1



I used the code

gen dummy =!missing(A), group(B)

but it says group ()not allowed please help. Thanks

Help interpreting etregress results

$
0
0
Good day, everyone! I am a beginner at Stata and I am conducting my undergraduate thesis. I came across the etregress command in one of my reference material.

I would just like to ask how to interpret the results. All I have been able to gather is that if /athrho is insignificant, we fail to reject the null hypothesis that there is no endogeniety, and even then I am not sure if that is correct.

I also read in this forum something about lambda and the Mills ratio. I would also like to ask how to interpret lambda and how to apply it in the discussion of my results.

Lastly, I would also like to know how to interpret the last line of the output in Stata:
Wald test of indep. eqns. (rho = 0): chi2(1) = 0.44 Prob > chi2 = 0.5082

I am sorry for asking such beginner questions. I hope you can guide me to better understanding. Thank you for your patience.

Code:
. etregress lnmpcccons i.gender age agesq ib1.education ib1.occupation i.spousework hhsize i.urbanrural i.agrihh ib0.region, treat( savings= i.gender ib1.education ib1.occupation
>  i.urbanrural ib0.majorregion)

Iteration 0:   log likelihood = -47519.925  
Iteration 1:   log likelihood = -47516.814  
Iteration 2:   log likelihood = -47516.674  
Iteration 3:   log likelihood = -47516.674  

Linear regression with endogenous treatment       Number of obs   =      40171
Estimator: maximum likelihood                     Wald chi2(35)   =   64028.51
Log likelihood = -47516.674                       Prob > chi2     =     0.0000

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lnmpcccons   |
      gender |
     Female  |   .0200998   .0069047     2.91   0.004      .006567    .0336327
         age |   .0221425   .0011321    19.56   0.000     .0199236    .0243614
       agesq |  -.0001795   .0000108   -16.62   0.000    -.0002007   -.0001584
             |
   education |
     lessHS  |  -.2481496   .0070105   -35.40   0.000      -.26189   -.2344092
     postHS  |   .1825727    .015147    12.05   0.000     .1528852    .2122603
   undrColl  |   .1883856    .010537    17.88   0.000     .1677334    .2090378
   gradColl  |   .5408572   .0124758    43.35   0.000      .516405    .5653094
             |
  occupation |
       None  |  -.0942983   .0089295   -10.56   0.000    -.1117997   -.0767969
       Srvc  |  -.1813907    .012531   -14.48   0.000    -.2059511   -.1568303
        FFF  |   -.231482   .0097222   -23.81   0.000    -.2505371   -.2124268
      Trade  |  -.2085894   .0113729   -18.34   0.000    -.2308798   -.1862991
      Machn  |  -.1758853   .0128373   -13.70   0.000     -.201046   -.1507246
  Unskilled  |  -.2556389   .0095443   -26.78   0.000    -.2743454   -.2369324
    Special  |  -.2060041   .0443966    -4.64   0.000    -.2930198   -.1189885
             |
  spousework |
   Employed  |   .0603052   .0054892    10.99   0.000     .0495465    .0710639
      hhsize |  -.1173599   .0011544  -101.66   0.000    -.1196224   -.1150973
             |
  urbanrural |
      Rural  |  -.2207572   .0067701   -32.61   0.000    -.2340263   -.2074881
             |
      agrihh |
       Agri  |  -.2653004   .0074923   -35.41   0.000     -.279985   -.2506158
             |
      region |
        CAR  |  -.3130079   .0153421   -20.40   0.000    -.3430778    -.282938
    RegionI  |  -.2882502   .0144554   -19.94   0.000    -.3165823   -.2599181
   RegionII  |  -.2827657   .0150802   -18.75   0.000    -.3123224    -.253209
  RegionIII  |  -.0449132   .0126781    -3.54   0.000    -.0697618   -.0200645
  RegionIVA  |  -.1205495   .0117696   -10.24   0.000    -.1436174   -.0974815
  RegionIVB  |  -.4996433   .0160114   -31.21   0.000    -.5310251   -.4682616
    RegionV  |  -.4008348   .0144166   -27.80   0.000    -.4290909   -.3725787
   RegionVI  |  -.3842323   .0139014   -27.64   0.000    -.4114786    -.356986
  RegionVII  |  -.4257214   .0141991   -29.98   0.000    -.4535511   -.3978917
 RegionVIII  |  -.5009164   .0152565   -32.83   0.000    -.5308185   -.4710143
   RegionIX  |  -.6382387   .0158506   -40.27   0.000    -.6693054   -.6071721
    RegionX  |   -.571888   .0156281   -36.59   0.000    -.6025185   -.5412576
   RegionXI  |  -.3430152   .0145741   -23.54   0.000    -.3715798   -.3144505
  RegionXII  |   -.467563   .0150714   -31.02   0.000    -.4971025   -.4380235
       ARMM  |  -.2962025   .0162721   -18.20   0.000    -.3280953   -.2643097
     CARAGA  |  -.4357856   .0161733   -26.94   0.000    -.4674846   -.4040866
             |
     savings |   .3587962   .0324674    11.05   0.000     .2951613    .4224312
       _cons |   8.287544   .0331734   249.83   0.000     8.222525    8.352563
-------------+----------------------------------------------------------------
savings      |
      gender |
     Female  |   -.042895   .0191203    -2.24   0.025      -.08037     -.00542
             |
   education |
     lessHS  |  -.2711064   .0191815   -14.13   0.000    -.3087015   -.2335113
     postHS  |   .3252731   .0384256     8.47   0.000     .2499604    .4005859
   undrColl  |   .1818193   .0278539     6.53   0.000     .1272267     .236412
   gradColl  |   .6602118   .0253974    26.00   0.000     .6104338    .7099899
             |
  occupation |
       None  |   -.151249   .0227643    -6.64   0.000    -.1958662   -.1066318
       Srvc  |  -.0633397   .0338512    -1.87   0.061    -.1296868    .0030075
        FFF  |  -.3788235   .0252428   -15.01   0.000    -.4282984   -.3293486
      Trade  |  -.2375267   .0315493    -7.53   0.000    -.2993621   -.1756913
      Machn  |  -.0886138   .0348941    -2.54   0.011     -.157005   -.0202226
  Unskilled  |  -.4453145   .0255374   -17.44   0.000    -.4953669   -.3952621
    Special  |   .1595485   .1181011     1.35   0.177    -.0719254    .3910224
             |
  urbanrural |
      Rural  |  -.2537893   .0176925   -14.34   0.000     -.288466   -.2191126
             |
 majorregion |
  Bal Luzon  |   -.197786   .0253054    -7.82   0.000    -.2473836   -.1481884
    Visayas  |  -.4764414   .0295201   -16.14   0.000    -.5342998    -.418583
   Mindanao  |   -.518607   .0268327   -19.33   0.000    -.5711982   -.4660158
             |
       _cons |  -.1183562   .0271676    -4.36   0.000    -.1716038   -.0651087
-------------+----------------------------------------------------------------
     /athrho |   .0241147   .0364425     0.66   0.508    -.0473112    .0955407
    /lnsigma |  -.6917304   .0035504  -194.83   0.000     -.698689   -.6847718
-------------+----------------------------------------------------------------
         rho |   .0241101   .0364213                     -.0472759     .095251
       sigma |   .5007089   .0017777                      .4972368    .5042053
      lambda |   .0120721   .0182413                     -.0236802    .0478244
------------------------------------------------------------------------------
Wald test of indep. eqns. (rho = 0): chi2(1) =     0.44   Prob > chi2 = 0.5082

Change in the value of a variable

$
0
0
Hello
I have two variables: ID and Pointpers
ID = Individual ID for each researcher
Pointpers= sum of publication points per researcher every year
I want to count the change (difference) in publication points per year of researchers from their points (only) previous year .
I used this command :
-by ID: generate changepoint=Pointpers-Pointpers[_n-1] if _n>1 - but it shows the change in publication points from ALL previous years, but I want to see changes only from the previous.
What is missing in the command I used ?

Thanks for the Help

Do I need to compare the results of a standard GMM regression with those of a pooled OLS regression?

$
0
0
Dear Statalist society,

I have carried out a standard GMM regression with two instruments that I chose by assuming that they were suitable (I did not use other methods because of their complexity). I then evaluated the validity of my instruments by using a Hansen J-test for overidentifying restrictions and results show that my instruments are uncorrelated with the error terms of my equation.
However, I was told that I need to compare the results of my OLS regression with the results of my GMM regression to show the reliance and consistency of my results.


These are the results of the OLS regression

HTML Code:
 reg $ylist $xlist

      Source |       SS       df       MS              Number of obs =     720
-------------+------------------------------           F( 13,   706) =   86.39
       Model |    1218.138    13   93.702923           Prob > F      =  0.0000
    Residual |  765.768173   706  1.08465747           R-squared     =  0.6140
-------------+------------------------------           Adj R-squared =  0.6069
       Total |  1983.90617   719  2.75925754           Root MSE      =  1.0415

------------------------------------------------------------------------------
       lnFDI |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    lnAPA_ex |   1.061668   .2655766     4.00   0.000     .5402537    1.583083
    lngdp_ex |   2.218972   .2239381     9.91   0.000     1.779307    2.658636
    lngdp_im |   .1755009   .0566503     3.10   0.002     .0642776    .2867241
    lnCPI_ex |   3.746099   .9763996     3.84   0.000     1.829105    5.663094
    lnCPI_im |   .1393702   .0525016     2.65   0.008     .0362922    .2424481
   lndif_GDP |  -.0319451   .0067189    -4.75   0.000    -.0451366   -.0187536
   lndif_pop |  -.0463713   .0089667    -5.17   0.000    -.0639759   -.0287668
  lnfreed_im |   4.783194   .4739892    10.09   0.000     3.852597    5.713791
      lndist |   -.338742   .0528176    -6.41   0.000    -.4424404   -.2350437
      border |  -.1600089   .2449025    -0.65   0.514    -.6408334    .3208155
        open |  -.4679075   .1699626    -2.75   0.006       -.8016   -.1342149
        polc |   4.982644   .9516921     5.24   0.000     3.114159     6.8511
       _cons |   -41.7668   3.068047   -13.61   0.000    -47.79039   -35.74321
And these are the results of my GMM estimation

HTML Code:
ivregress gmm  lnFDI lngdp_ex lngdp_im lnCPI_ex lnCPI_im lndif_GDP lndif_pop lnfreed_im
> lndist border open polc (lnAPA_ex = lnGAPA_l1 lnAPA_im)

Instrumental variables (GMM) regression                Number of obs =     720
                                                       Wald chi2(13) = 1529.99
                                                       Prob > chi2   =  0.0000
                                                       R-squared     =  0.5716
GMM weight matrix: Robust                              Root MSE      =  1.0865

------------------------------------------------------------------------------
             |               Robust
       lnFDI |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    lnAPA_ex |   3.393222   .6411406     5.29   0.000      2.13661    4.649835
    lngdp_ex |   1.776358   .2145395     8.28   0.000     1.355868    2.196847
    lngdp_im |   .1900265   .0604584     3.14   0.002     .0715302    .3085228
    lnCPI_ex |   11.52501   2.196498     5.25   0.000     7.219956    15.83007
    lnCPI_im |   .2067215   .0682706     3.03   0.002     .0729135    .3405295
   lndif_GDP |  -.0338982   .0072998    -4.64   0.000    -.0482056   -.0195909
   lndif_pop |   -.044247   .0089408    -4.95   0.000    -.0617707   -.0267233
  lnfreed_im |   4.827352   .4997397     9.66   0.000      3.84788    5.806824
      lndist |  -.3231212   .0494157    -6.54   0.000    -.4199742   -.2262681
      border |  -.0571234    .137437    -0.42   0.678     -.326495    .2122481
        open |  -.6323952   .2426697    -2.61   0.009    -1.108019   -.1567714
        polc |   3.084821   1.022805     3.02   0.003     1.080161    5.089482
       _cons |  -48.58023   4.029627   -12.06   0.000    -56.47815    -40.6823
------------------------------------------------------------------------------
Instrumented:  lnAPA_ex
Instruments:   lngdp_ex lngdp_im lnCPI_ex lnCPI_im lndif_GDP  lndif_pop
               lnfreed_im lndist border open polc lnGAPA_l1 lnAPA_im
               
I haven't found much information about this comparison on Google. So, I unfortunately don't know what to compare between the OLS and GMM and what the differences would imply.
I am eagerly requesting the help of an expert in this forum. Thank you very much in advance.

DIfference between RE Tobit, FE Tobit and Tobit model?

$
0
0
Hello community,
What are the Random effects and Fixed effects Tobit that are done with the command xttobit and how do they differ from a normal Tobit model that uses the command tobit?

How to Compute Shared Prosperity Index

$
0
0
Dear STATA Users,

Greetings! Given the following example, where my objective is to compute Shared Prosperity Index for two different data points/periods (represented by 2001 and 2015), for say 11 individuals.. This shared prosperity has been defined as fostering income growth of the bottom 40 per cent of the welfare distribution in every country, and is measured by annualized growth in average real per capita consumption or income of the bottom 40 per cent. For details pls. refer to http://www.worldbank.org/en/topic/po...red-prosperity)
Observation 2001 2015
1 20 21
2 25 29
3 15 14
4 18 20
5 40 35
6 45 60
7 58 65
8 37 40
9 12 18
10 30 32
11 50 58
Can anyone help in this regard?

Regards,
Aswini

*HELP* Two-way fixed effects model

$
0
0
Hi Statalisters,

I am currently working on my Thesis and I am having problems on STATA - which I am using for the first time.

I have a panel data which spans from 2008 through 2015 and covers 181 Italian listed family firms. My main interest is the relation between founding-family ownership and firm performance. The analysis also incorporates variables that identify CEOs as firm founders, descendants of the firm's founder, or outsiders. I would like to use a two-way fixed effects model for my regression analysis.

The paper I have read that does something similar describes the fixed effects to be dummy variables for each year of the sample and dummy variables for each two-digit SIC code (I would like to use ATECO 2007 Code since I am talking about Italy), and the regression they employ is the following:

Firm Performance= δ0 + δ1 (Family Firm) + δ3 (control Variables) + δ3 + δ54 (Two digit ATECO Code) + δ'93-'99 (Year Dummy Variables) + 𝛆

where
Firm Performance = ROA based on EBITDA and net income, and Tobin's q;
Family Firm = binary variable that equals one when the founding family is pre- sent in the firm, and zero otherwise; Control Variables = officer and director holdings less family holdings, fraction of independent directors serving on the board, research and development expenses divided by total sales, long-term debt divided by total as- sets, stock return volatility, natural log of total assets, and the natural log of firm age;
Two-Digit ATECO Code = 1.0 for each two-digit SIC code in our sample;
Year Dummy Variables = 1.0 for each year of our sample period."

Now, my Professor has suggested me to do this in STATA:

- encode Company, gen (Company1)
- xtset Company1
- xtset Company1 Year
- encode ATECOCode2007, gen(ATECO)
- xtset ATECO
- egen id = group(Year ATECO)

*I hereby created a joined variable of Year and ATECO in order to replicate via an OLS the two-way fixed effects model - then I performed the areg code*

- generate young = (Firmageyears<50)
- generate old = (Firmageyears>50)

- generate CEOhire = (CEOfam<0.5)
- generate CEOfounder = (CEOfound>0.5)
- generate CEOdescendant = (CEOdesc>0.5)

*To specify, in my excel the variable FamilyFirm is already a dummy - do I have to generate one on STATA as well?*

- areg ROA FamilyFirm Officersanddirectorsownless DE DEBITDA Returnperemployee Salesgrowth CapexPPE1 LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb (id)
- areg ROE FamilyFirm Officersanddirectorsownless DE DEBITDA Returnperemployee Salesgrowth CapexPPE1 LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb (id)
- areg Tobinsq FamilyFirm Officersanddirectorsownless DE DEBITDA Returnperemployee Salesgrowth CapexPPE1 LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb (id)

*Removed Returnperemployee, CapexPPE1 - First set: FF/NFF*
- areg ROA FamilyFirm Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg ROA FamilyFirm Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg ROA FamilyFirm Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)

*Second set - young/old*
- areg ROA young old Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg ROE young old Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg Tobinsq young old Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)

*Third set: CEOhire/CEOfounder/CEOdescendant*
- areg ROA CEOhire CEOfounder CEOdescendant Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg ROE CEOhire CEOfounder CEOdescendant Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)
- areg Tobinsq CEOhire CEOfounder CEOdescendant Officersanddirectorsownless DE DEBITDA LTDTA1 Returnvolatility1 lnTotalassets Lnfirmage, absorb(id)


** PROBLEMS **
0. Is first of all, right the areg code, or is there a better way to create a two-way fixed effects model?
1. I have NO INTERCEPT in my regression results
2. If I were to add the variable x Outsidedirectors, my variable FamilyFirm is omitted from the regression because of Collinearity problems.... how come? This would be an important variable for my model and I did not have this kind of problem in my old database...is there a problem on Excel maybe?


Thank you A LOT in advance for your help!

Synergistic effects of three independent variables

$
0
0
Hey there,

I'm doing research on whether three variables together have more effect on dependent variable than either by themselves. In other words:
Effect on Y if we only have X1
Effect on Y if we only have X2
Effect on Y if we only have X3
Effect on y if we have both X1, X2, X3

Initially, i was comparing:
y = x1 x2 x3
vs.
y = Z with Z=X1+X2+X3
--> where i just interpreted beta X1 vs. beta Z, to see whether the effect was stronger or not.

I just found out that this is wrong, though i don't understand how to remedy this. my deadline is in a couple of days and my promoters never told me that it was wrong. So, what exactly do i have to do then? I created a new variable by multiplying each separate variable, but that doesnt seem to fit either.

note: dependent and all independent variables are ordinal


Drawing observations from bivariate heteroskedastic normal

$
0
0
Hi,

as the title suggests I was wondering if there's any way in Stata to generate two variables that are drawn from a bivariate normal distribution in which the variance of each variable has its own form of heteroskedasticity. In the case that the variables are independent you can generate a variable for the heteroskedastic standard deviation, and use that variable within rnormal() to generate the heteroskedastic variable. For homoskedastic variables you can use drawnorm, but I can't seem to be able to find a way to do both. The purpose is to simulate Tobit Type II data, where both the variance in the selection and value processes are heteroskedastic.

Thank you for any help or direction in this matter!

Counting zeros

$
0
0
Is there a quick way to count the zeros in a number? For example, 500 000 has five zeros.

Repeated commands for different variables

$
0
0
Dear All,

I would really appreciate if someone could help me. I need some guidance how to make code below be looped instead of repeated for every variable:

clear
use singular
tsset date
keep date E1 C1
rename E1 E
rename C1 C
sort date
save C1, replace
clear
use singular
tsset date
keep date E2 C2
rename E2 E
rename C2 C
sort date
save C2, replace
clear
use singular
tsset date
keep date E3 C3
rename E3 E
rename C3 C
sort date
save C3, replace
clear
use singular
tsset date
keep date E4 C4
rename E4 E
rename C4 C
sort date
save C4, replace


Thank you in advance!
Marijus
Viewing all 72862 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>