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

Different heterogeneity statistics for proportions in the same subgroup using -metan- vs -metaprop_one-

$
0
0
Hello,

I am running meta-analysis for proportions and tried both -metan- vs -metaprop_one- for subgroup analysis as follows. -metaprop_one- used exact confidence limits for a binomial proportion. The general results are pretty close using two statements. However, for subgroup 3 which only has two studies, the heterogeneity statistics are substantially different. Has anyone run into this problem? Is there any explanation and preferred method to use? Thank you!

metan prop se, random by(subgroup) xlabel(0, 0.2, 0.4, 0.6, 0.8, 1.0) ///
label(namevar =firstauthor, yearvar =publicationyear) ///
sortby(publicationyear) plotregion(color(white)) graphregion(color(white)) bgcolor(white)

metaprop_one ergpositive samplesize, random by(subgroup) cimethod(exact) ///
label(namevar =firstauthor, yearvar =publicationyear) xlab(0, 0.2, 0.4, 0.6, 0.8, 1.0) sortby(publicationyear) /// plotregion(color(white)) graphregion(color(white)) bgcolor(white)

tmap/smap USMAPS redundant lines

$
0
0
Dear Statalisters,

Although I follow the precise instructions from Maurizio Pisati (one should sort boundary files by _ID, as suggested in p. 9 from http://fmwww.bc.edu/repec/bocode/t/tmap2-UserGuide.pdf , and in http://www.stata.com/statalist/archi.../msg00715.html ), I still cannot replicate the maps from the first link above. Even though I followed the steps described in p. 10 of my link 1, I still get maps that look like the figure below.
I tried to create my own shape file following the instructions in http://www.stata.com/support/faqs/gr...pmap-and-maps/, but from the files hosted in http://www.nws.noaa.gov/geodata/cata...l/us_state.htm, one ends up with a shapefile that contains Maryland twice!
My third attempt was by using instead the module http://econpapers.repec.org/software...de/s448401.htm by Scott Merryman, but if one runs the .do file, after the 2bd command one gets an error (master file not sorted). Maybe the first line is what I am missing?

Code:
di in r "colorschemes.dta must be on the adopath" _n // I guess this line is wrong?
use "rma_summary.dta", clear
tmap chor lossratio , id(id) map("us_west.dta") palette(Blues) ocolor(white) osize(medium)  legtitle("Loss Ratios")
I would appreciate your feedback.
Array

Interaction term

$
0
0
Hello folks,
I try to add an interaction term to my model but have no idea how to do that. I was wondering if someone could help me. Thank you so much

margins after mlogit beta coefficients

$
0
0
Dear Stata users,

I am running a margins command after mlogit. But if I compare the beta-coefficience of mlogit with the dy/dx of margins they don't point in the same directions (different algebraic signs) and have different significances.
Is my assumption right, that this shouldn't happen because of marginal effect = B*P*(1-P) ? What could be the mistake?

I'd appreciate your answer

Error Message Convergence not achieved in etregress before iterations

$
0
0
I'm running etregress in Stata 14. It gives me a "convergence not achieved" message but that occurs before the iteration log. It also says "missing standard errors indicate some of the parameters are not identified" but there are no missing standard errors.

I can't provide a data example due to size, but the output is below. Should I be worrying about the convergence message before the iterations? Suggestions please.

Phil


etregress FmtbAve1_3 L1mtb L1ind_mtb F1ind_mtb L1roa L1ind_roa F1ind_roa L1at L1revt Lboardsize LNcaucasian1 LNmen LNoutsidebd ///
> if use==1, treat(Null= Ldatadate L1ind_at L1ind_ebit L1ind_roa L1mkt_value L1revt L1roa L2bkvlps L2ebit L2ind_at L2ind_ebit L2ind_mtb LAllWhite Lap Laqc ) ///
> vce(robust)
convergence not achieved
The Gauss-Newton stopping criterion has been met but missing standard errors indicate some of the parameters are not identified.

Iteration 0: log pseudolikelihood = -8607.2694
Iteration 1: log pseudolikelihood = -8533.9854
Iteration 2: log pseudolikelihood = -8531.806
Iteration 3: log pseudolikelihood = -8531.7975
Iteration 4: log pseudolikelihood = -8531.7975

Linear regression with endogenous treatment Number of obs = 3,344
Estimator: maximum likelihood Wald chi2(13) = 696.40
Log pseudolikelihood = -8531.7975 Prob > chi2 = 0.0000

------------------------------------------------------------------------------
| Robust
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
FmtbAve1_3 |
L1mtb | .6173737 .0476638 12.95 0.000 .5239544 .710793
L1ind_mtb | -.00173 .0017342 -1.00 0.318 -.0051289 .0016689
F1ind_mtb | .6458511 .1032618 6.25 0.000 .4434616 .8482406
L1roa | .0329101 .0094866 3.47 0.001 .0143168 .0515035
L1ind_roa | -6.416385 1.877586 -3.42 0.001 -10.09638 -2.736385
F1ind_roa | -1.36676 3.651841 -0.37 0.708 -8.524237 5.790718
L1at | -.1263021 .1593853 -0.79 0.428 -.4386915 .1860873
L1revt | .7646522 1.074971 0.71 0.477 -1.342251 2.871556
Lboardsize | .1418719 .0378133 3.75 0.000 .0677592 .2159846
LNcaucasian1 | -.0554023 .024755 -2.24 0.025 -.1039212 -.0068833
LNmen | -.1094744 .0323472 -3.38 0.001 -.1728736 -.0460751
LNoutsidebd | .0012599 .0052522 0.24 0.810 -.0090342 .011554
1.Null | -2.059116 .4950943 -4.16 0.000 -3.029483 -1.088749
_cons | .4653399 .1935304 2.40 0.016 .0860273 .8446525
-------------+----------------------------------------------------------------
Null |
Ldatadate | -.0002607 .0000541 -4.82 0.000 -.0003667 -.0001546
L1ind_at | -6.06e-08 2.79e-08 -2.17 0.030 -1.15e-07 -5.95e-09
L1ind_ebit | 2.17e-07 3.31e-07 0.65 0.513 -4.32e-07 8.65e-07
L1ind_roa | -1.172686 .9978161 -1.18 0.240 -3.12837 .7829973
L1mkt_value | -1.24e-06 1.58e-06 -0.79 0.432 -4.33e-06 1.85e-06
L1revt | -.6133746 1.521015 -0.40 0.687 -3.59451 2.367761
L1roa | -.0019713 .0039945 -0.49 0.622 -.0098003 .0058577
L2bkvlps | .0010208 .0007754 1.32 0.188 -.000499 .0025406
L2ebit | -5.08e-06 3.90e-06 -1.30 0.193 -.0000127 2.57e-06
L2ind_at | 5.90e-08 2.75e-08 2.14 0.032 5.00e-09 1.13e-07
L2ind_ebit | 1.79e-07 3.09e-07 0.58 0.561 -4.26e-07 7.85e-07
L2ind_mtb | -.0041626 .0441417 -0.09 0.925 -.0906788 .0823535
LAllWhite | .1284362 .0474345 2.71 0.007 .0354663 .221406
Lap | 1.02e-06 3.37e-07 3.02 0.003 3.57e-07 1.68e-06
Laqc | .0000155 9.89e-06 1.57 0.117 -3.89e-06 .0000349
_cons | 4.174541 1.029673 4.05 0.000 2.156419 6.192662
-------------+----------------------------------------------------------------
/athrho | .7655414 .1885081 4.06 0.000 .3960722 1.135011
/lnsigma | .7015973 .1008839 6.95 0.000 .5038685 .899326
-------------+----------------------------------------------------------------
rho | .6443294 .110247 .3765832 .8127272
sigma | 2.016972 .2034799 1.655112 2.457946
lambda | 1.299594 .3400837 .6330424 1.966146
------------------------------------------------------------------------------
Wald test of indep. eqns. (rho = 0): chi2(1) = 16.49 Prob > chi2 = 0.0000

Storing Person-Specific Marginal Effects in a Variable?

$
0
0
Hi Statalist,

I am trying to estimate person-specific marginal effects for a structural form equation, and I need a way to save the marginal effects that Stata creates for each person when you run the following command:
Code:
xtpoisson DEPENDENT INDEPENDENT
margins, dydx(INDEPENDENT)
I was hoping that I could save the marginal effects that Stata computes for each person into a variable so that I could then multiply these marginal effects by the marginal effects from a second model, and then take the mean of those marginal effects. I read online that this may be a possible solution:
Code:
xtpoisson DEPENDENT INDEPENDENT
margins, dydx(INDEPENDENT) post
estimates store margins1
Is this going to save my person-specific marginal effects into a variable? If not, is Stata able to do something like this? I assume they are calculated before calculating the average marginal effects, but I was wondering if there was a way to actually save them into a variable.

Thanks!

looping over dates with formating

$
0
0
I have a bunch of dates reflecting date of joining (DOJ). I want to do a bunch of calculations for each DOJ. Before getting into the calculations I want to display the date through which I am looping through.

qui: levelsof DOJ, local(levels)
foreach l of local levels{
di "`l'"
...
}

The code above works, but it displays dates as integers. Is there any way to convert that into intelligible dates. I tried

qui: levelsof DOE, local(levels)
foreach l of local levels{
format `l' %tdMonth dd, CCYY
di "`l'"
...
}

but i get errors (see below) and I am not sure how to work around this without generating a new variable converting it into a date and then dropping it before exiting the foreach loop - that sounds inefficient. Thank you for any advise. I feel like I am missing something obvious here.

. qui: levelsof DOJ, local(levels)

. foreach l of local levels{
2. format `l' %td
3. di "`l'"
4. }
8174 invalid name
r(198);

Fixed vs. random effects and year dummies

$
0
0
Hi all,
I'm currently working on my dissertation using Stata and I'm a little confused.

I'm looking to find the determinants of a firm's borrowing source. Regressing debt source/total debt against firm characteristics. I'm also including year dummies for each year 2005-2011 because I want to look at how borrowing sources changed over the course of the financial crisis. I'm getting very confused reading about which regression model to use. I thought because I think there are probably omitted variables I would use fixed effects, but then I'm reading a paper where they've used random, and another similar one that has used a tobit regression with limits at zero and unity (I have no idea about tobit regressions). Fixed effects and random effects seem to give me the same coefficients.

Am I right in interpreting year dummies like this: say there's a coefficient of -0.5 for 2008 (and it's statistically significant), in 2008 on average firms had less than the proportion of this kind of debt than would be predicted by the coefficients of the variables. (0.5 less of this kind of debt as a proportion of total debt?)

Again from this paper using tobit regression, as one of the dependent variables 'leverage' would have similar determinants to the independent variable 'debt source', they have regressed 'leverage' against the other variables and after used 'predict... , residuals' and then used this variable in the regression in the place of 'leverage'. However I get the error message 'option residuals not allowed.' I think because I cannot do this with the regression I'm using? Is there a way around this or shall I just leave this variable out?

Thanks in advance if you can shed some light on any of this.

chi2 with clustered data

$
0
0
Hi,

I want to calculate a chi2 using clustered data. My two example variables of interest are study timing (dichotomous variable 'timeat3nospan': 1=post-policy; 0=pre-policy) and race (four category variable 'Hirace'). I want to know if there are different proportions of people by race in each study timing category. Without clustering my code would look like:

tab timeat3nospan Hirace, chi2 row


However, I can't figure out the code for accounting for clustering. Instead I'm running a logistic regression:

xi: logistic timeat3nospan i.Hirace, cluster (bl_V5)


but this isn't exactly what I want b/c it creates a reference category for Hirace. Although, perhaps this is most appropriate b/c it does produce an overall chi2.

I've found on-line some user written code called clchi2 but I'm unsure whether I should use it. Any suggestions are most welcome!

Thanks,
Jodi Anthony

Executing Mata syntax over several dataset

$
0
0
Hi all. I'm trying to execute a routine over several datasets however, it stops after the first year. The syntax is,

local years 2003 2008 2015
foreach i of local years {
cd "C:/Users/Document/Data/`i'"
use "data`i'.dta"

putmata X=(x1 x2 x3)

mata
X
hh=rows(gzero)
X
hh

w=(1,2,3)
w

X1=X:*w
X1

c=rowsum(X1)

c_md=J(hh,1,0)

for (i=1; i<=rows(c); i++) {
if (c[i,1] >= 3/7) {
c_md[i,1] = 1
}
}

q = colsum(c_md)

end
clear all

Thanks in advance

Nhanes

Combining Variables Across Observations

$
0
0
Hello all,

I wish to collapse(sum) all of the variables in 3 company-year observations with 3 company-year observations of another company in my dataset. I would like the second company to absorb the variable values of the first company for the particular years of interest. An example is listed below:
15349 1994 Company 1 2726.6
15349 1995 Company 1 2775
15349 1996 Company 1 2730.4
10787 1994 Company 2 2416.378
10787 1995 Company 2 3381.461
10787 1996 Company 2 3953.936
10787 1997 Company 2 10447
10787 1998 Company 2 16526.6
10787 1999 Company 2 32361.6
10787 2000 Company 2 40404.3
The value in the left hand column is the unique company identifier, which I believe will be needed for coding purposes. The right most column is one particular variable for explanatory purposes.

I would like the observations for company 1 in years 1994, 1995, 1996 to be absorbed by company 2's observations in 1994, 1995, and 1996. Again, although only one variable has been given as a check for anyone willing to help out, I would like all of the variables for each observation of company 1 to be combined with its corresponding company-year observation in company 2. Ideally, I would like the absorbed observations to be removed from the dataset in the process, as I will be doing a nearest neighbor match later in my data analysis.

Should be simple, but I'm new to Stata and want to get this right!

Thanks!

Erik

Simultaneous equation (reg3) and clustered standard errors

$
0
0
Hi everyone,

Does anyone know how to obtain clustered standard errors when using reg3 or sureg? I've looked online and there doesn't seem to be a straightforward solution. Bootstrapping alone does not work either-- the clustering is key.

Thanks!

Simultaneous Equations (REG3) and Endogeneity Test Result(Hausman Test)

$
0
0
Hi All,

I have following set of simultaneous equations:

Y = X + A + B + C + D (1)
X = Y + E + F + G + H (2)

In above equations variables X and Y are endogenous variables. The variables F G and H are instruments for endogenous X variable. I solve it using 3SLS (reg3) command as follows :

reg3 (Y X A B C D) (X Y E F G H), first

I wish to get the p value for hausman test of simultaneity for both equations. Can anyone help please to get the value of endogeneity test for both equations after this reg3 command. Solution can help many other users as well. Cheers

ADF-test. My data has a unit-root, now what?

$
0
0
Hello everyone,

I have a monthly dataset, time-series, from about 1962 until 2008 where I want to regress the effect of several variables on the federal funds rate. It turns out however, when I perform the ADF-test, that most of my variables have a unit root.

1) My research supervisor suggested to take the first difference of all variables, and indeed in this case the unit root disappears. However, I'm having a very hard time trying to interpret a first difference regression. Am I not researching whether the trend of the variable accelerates or decelerates in that case? Because that wouldn't say anything about the effect of the indep variables on the ffr (dep var), would it?

2) On the following website (https://www.researchgate.net/post/Is...for_Panel_data) I interpret that in case the first difference is stationary, your data is stable. Does this mean that I can just regress my normal data because the first difference of all my variables does not have a unit root?

3) I read a bit about ARIMA models. Supposedly solving for a unit root?

The point is, I have a unit root and I need to take care of this problem. Yet, I'm no econometrics expert and I have never learned anything about the unit root at my university. So how can I solve this or work my way around this? I'm also not familiar with ARIMA models.
I hope you can comment on points 1,2 and 3 or suggest point 4 to solve my problem.

Thanks in advance!

Re: xtpedroni

$
0
0
Hi,

I have implemented the command xtpedroni in Stata to check for cointegration. xtpedroni is a user written command and appears in 'The Stata Journal' - https://www.econ.uzh.ch/dam/jcr:0000...3e4/sj14-3.pdf (page 684 in the journal or page 238 in pdf)

I am unsure how to interpret the cointegration statistics. All test statistics are distributed N(0,1) under a null of no cointegration.


Stata returns:
Test Stats Panel Group
v 1.29 .
rho -7.286 -5.6
t -11.37 -12.46
adf -7.311 -6.243

I would really really appreciate any assistance, please?

Kind regards,

Paula

Probit MLE

$
0
0
Hello, My question is mostly based on the econometric though I understand that this is a stata forum.

This is my probit model:
Code:
Prob[y_ij=1]= Φ(β_0+ β_1 〖Educ〗_j+ X_ij^' β_2+X_j^' β_3+μ_ij  )
i represents individuals and j represents households.
I am not so sure how I should write out its MLE.

This is what I have :

Code:
L= ∑_(i=1)^N▒y_ij   〖log〗_e [Φ(β_0+ β_1 〖Educ〗_j+ X_ij^' β_(2 )+X_j^' β_█(3@   ) )]+∑_(i=1)^N▒(  1-y_ij)〖log〗_e [1-Φ(β_0+ β_1 〖Educ〗_j+          X_ij^' β_2+ X_j^' β_(3   ))]
Should I imclude another summation from j=1 to M?
Or I can leave it as it is?

Correlation in Panel Data

$
0
0
Dear statlist,

i am trying to calculate correlation coefficients for a panel dataset.

Suppose you have the following dataset on IDs and years:
Year ID X
1992 10 2600
1992 11 1000
1993 10 800
1993 11 700
1994 10 6000
1994 11 2500
Obviously, variable X is an ID and Year specific item. I would like to calculate, let say for time t=1994 the correlation of variable X between ID 10 and 11 for the years 1992-1994.

I know this might be a very straightforward question. However, I tried several things but could not find a convenient solution.

Thanks in advance!

Best,

Alex L

Elixhauser Question

$
0
0
I have a stata coding challenge that im working on with a data set on simulated administrative claims. There are 14 variables including diagnosis1 to diagnosis4. The questions asks:

Install the user contributed Stata module, "Elixhauser." Using the ICD-9 enhanced option, run the module to create Elixhauser comorbidity flags and a count of comorbidities.

I am very new to Stata and would like some advice as to what the question is asking. Do they want me to count the number of comorbidities for each of the diagnosis? If so, am I required to develop an ICD-9 code for each diagnosis? How do i do that? I have installed elixhauser but have no idea where to go from there. Any advice would be greatly appreciated.

Please help me with Event study and Brexit

$
0
0
Hi guys, I am doing about analysing the impact of Brexit on British stock market i.e. FTSE 100 and FTSE 250. I did run OLS for estimation window to find the market model for each company in FTSE 100 and FTSE 250. And then, I found the abnormal returns for each in the event window from day -7 to day 30 ( day 0 is 23/06/2016 - official date of referendum). After that, average abnormal return for each day in the event window and cumulative abnormal return (CAAR) for the whole period were computed. But the result I got was not as I expected, CAAR for both FTSE 100 and FTSE 250 are negative while in fact, there were a significant increase for both FTSE 100 and FTSE 250.
Does anyone know where is the problem in this case?
I thought the reason is that I calculated the abnormal return by using the market index. And the market index was impacted by Brexit too. So the result is not reliable because of the correlation. I am not sure.
Thank you so much and any advice would be greatly appreciated.
Sincerely,


Mike
Viewing all 72797 articles
Browse latest View live


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