Quantcast
Channel: Statistics Help @ Talk Stats Forum - Stata
Viewing all 800 articles
Browse latest View live

Outreg problem with reporting Pseudo-R2 with Quantile regression

$
0
0
Dear Talk stats users,

I need help with reporting the Pseudo-r2 (using outreg2) when doing quantile regressions in stata (Qreg, Stata 12).

How do I achieve this? I've found two possible solutions so far, that I have been unable to solve the problem with.

The first is to use ,addstat("Pseudo R2", e(r_p) after the outreg2 commandos, and the other is to generate Pseudo R2 by myself by using Pseudo R2 = 1 - (e(sum_adev) / e(sum_rdev)) in the outreg2 environment. When using the first solution only a "." is reported. When using the other one I run into syntax errors (or errors of similar sort). My guess is that the last one could prove to be a possible solution, but how do I write it properly in stata?

If you have any other suggestions or could help me in any way, I am very greatful.

Regards
Olleolle

xtabond2 suppressing the constant

$
0
0
Hi all,

When using the difference GMM estimator, the constant is differenced out by way of the first-difference transformation. So using the option "noconstant" is moot.

But what is the interpretation of the constant in System GMM? The system GMM uses the original levels equation and the first differenced equation to create a "system" of equations allowing for more instruments and usually greater efficiency. So is the constant term coming from the levels equation in System GMM?? :confused:

Thank you in advance

xtset issues

$
0
0
Hi, I am new to panel regressions and I have a question regarding xtset in Stata 12. I have tried two different panel datasets where I have been running a simple regression. First I tried with:
Code:

xtset id time
xtreg dv iv1 iv2 iv3, fe

and then I tried
Code:

reg dv iv1 iv2 iv3
And I get the same result, how is this possible?

I am writing my MSc thesis and my results looks horrible, so I just wanna make sure I am doing it the right way.

Question on Clarify

$
0
0
Hello, I'm using Clarify for the first time to get marginal effects for an OLS model I'm using. In general, I'm wondering how to interpret what Stata is spitting out after setting the variables to values?

Here's my model:

Y (Continuous) = X1 (binary) + X2 (binary) + X1X2 (interaction) + various controls

I am aware of what Clarify does for those marginal effects used for logit, probit, etc., but what is the substantive meaning of the output on OLS models?

Thanks.

[STATA - Lag length criteria]: How can I explain the results?

$
0
0
Good evening everyone.
I got different output from the code:
Code:

forval i = 1/118 {
        varsoc Illiq`i', maxlag(10)
        }

that describes AIC,BIC,... lag information criterion, but I don't know how I can interpret them.
How can I choose the correct number of lags on the basis of all these output?
I know that, in the case in which I have only one variable, I've to choose the smallest value of AIC and the others, but what I have to do in the case I have more outputs?
Thanks for helping!

Creating an age variable from a date of brith variable

$
0
0
Hi there,

I'm a bit confused with how to manipulate date variables in stata. I have a dataset in excel of client information which I have uploaded into Stata. One of my variables is date of birth expressed as DMY. How do I go from this to create an age variable expressed in years?

Regards

Jamie

Drop group if only one observation.

$
0
0
I have a huge unbalanced panel dataset. xtset companyid period. (Period is from -1 to 13.)
One dependent variable (shares) depicts how many shares each company holds each period.
For some companies I only have one observation for this variable and the rest is missing variables. In other words, they only held shares in one of the fifteen (-1 to 13) periods.

How do I do to drop these companies (the whole group) from the dataset?

Thanks in advance!

avoiding double counting from merged datasets

$
0
0
Hi there,

I have merged two client datasets. The first dataset contains demographic information about the individuals, the second contains those same individuals stock purchases over time.

When I merge them using the unique person identifier number I obviously have several rows now for each client (i.e. buying a specific stock or adding to a position for example)

When I do simple cross tabs I am counting the same individuals more than once. e.g. tab sex stockpurchase or tab economicstatus sex

What is the best way to avoid this double counting?

thanks for any help on this

jamieb

Deleting outliers AGE varieble

$
0
0
Hi all,

I am conducting a bi-variate analysis of age groups (>40 years, 40-49, and 50-75) and basic demographic characteristics of women who had a breast cancer screening. The first thing I want to do is delete outliers (this seems logic to me). Some participants wrote that they are 1, 2 or 130 years old- of course this is not possible. What would be a standard procedure to deal with this? What is the command?

Thank you in advance!
Marvin

Hausman test interpritation of results

$
0
0
Hi

Please, could you explain me the result of the Hausman test.
As I understand, since the p-value equals 0.2077 we fail to reject the null and there is a random effect. Am I right?
Thank you

. xtreg inv v k, fe

Fixed-effects (within) regression Number of obs = 40
Group variable: i Number of groups = 2

R-sq: within = 0.7055 Obs per group: min = 20
between = 1.0000 avg = 20.0
overall = 0.7990 max = 20

F(2,36) = 43.13
corr(u_i, Xb) = -0.8161 Prob > F = 0.0000

------------------------------------------------------------------------------
inv | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
v | .0297432 .0102282 2.91 0.006 .0089995 .050487
k | .1512254 .0186082 8.13 0.000 .1134861 .1889646
_cons | -2.990036 13.67695 -0.22 0.828 -30.72818 24.7481
-------------+----------------------------------------------------------------
sigma_u | 18.350226
sigma_e | 20.58156
rho | .44287371 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(1, 36) = 3.10 Prob > F = 0.0868

xttest0

Breusch and Pagan Lagrangian multiplier test for random effects

inv[i,t] = Xb + u[i] + e[i,t]

Estimated results:
| Var sd = sqrt(Var)
---------+-----------------------------
inv | 2232.544 47.24981
e | 423.6006 20.58156
u | 0 0

Test: Var(u) = 0
chibar2(01) = 0.00
Prob > chibar2 = 1.0000

. hausman fe re

---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| fe re Difference S.E.
-------------+----------------------------------------------------------------
v | .0297432 .0151926 .0145506 .0081377
k | .1512254 .1435792 .0076462 .0005188
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from xtreg
B = inconsistent under Ha, efficient under Ho; obtained from xtreg

Test: Ho: difference in coefficients not systematic

chi2(2) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 3.14
Prob>chi2 = 0.2077
(V_b-V_B is not positive definite)

Multiple response variable bad coding

$
0
0
Hi guys,

I have a race multiple response variable (participants can choose more that one option) that was coded incorrectly.

Race:
race1=white
race2=black
race3= Chinese
race4= Indian
race5= Hawaiian

yes=1
no=0

So each category is codes as 1 or 0 (dummy variables). If a participants do not answer any of the 5 dummies, all the option should be coded as missing. However, in my data, if a participants did not answer any of the 5 race categories, they coded all the categories as 0 whcih is wrong. I need to fix this problem for the analysis. Below is an example of my data. Any solutions?

id race1 race2 race3 race4 race5
1 0 0 0 0 0
2 1 0 1 1 1
3 0 . . . 1
4 0 . . 0 .
5 1 1 1 1 0
6 0 0 0 0 1
7 0 0 0 0 1
8 1 1 . 0 0
9 . . . . .
10 0 . 1 . 1
11 1 . . . .



My attempt was to generate a "missrace" variable which represent people who did not answer any of the 5 categories. missrace 1="did not answer any var" and 0= "answer at least one". and then recode my race dummies using the missrace variable

gen missrace = 0
replace missrace = 1 if race1+race2+race3+race4+race5==0

The problem are the missing values.

This is what I got

id race1 race2 race3 race4 race5 missrace
1 0 0 0 0 0 1
2 1 0 1 1 1 0
3 0 . . . 1 0
4 0 . . 0 . 0
5 1 1 1 1 0 0
6 0 0 0 0 1 0
7 0 0 0 0 1 0
8 1 1 . 0 0 0
9 . . . . . 0
10 0 . 1 . 1 0
11 1 . . . . 0

Id9 should be 1 (missing); id4 should be 1 (missing). How can I fix this problem... I tried a thousand things but I did not succeed!

Thanks in advance!

multivariate GARCH with sample expansion problem

$
0
0
I was asked to estimate multivariate GARCH model for the spot and futures returns series. But since the series only contain 66 observations, I was also requested to save the fitted conditional variances and covariances and then use them to construct the time-varying optimal hedge ratios.

I tried to figure out the problem offered, but failed after a full week's self-study. Could you help me solve the problem. STATA commands are desperately needed. Millions of thanks in advance.:shakehead

Tabulate : subsets from the same variable

$
0
0
Hi Stata Users,

You should maybe find my problem very basic... I have tried a lot but I am not able to find the answer.

I want to use this command, to compare two variables:
tab variable1 variable2, chi exp exact

My problem is : these two variables are subsets from the same variable (one column):
variable1 = variable if age > or = 50
variable2 = variable if age < 50

I do not want to create new variables to do this comparaison.

Is it a solution to have something like
" tab [variable if age > or = 50] [variable if age < 50], chi exp exact "

Any advice gratefully received.

Thanks,
A. Bodet, medical student

How to subtract two values from each other within the same variable??

$
0
0
Dear all,

One quick question. I've been trying to resolve this issue for quite some time now.

I want to see how many times did the 'decile' variable go from 5 to 9 within an 'id'. Therefore, if 9 comes before 5, that won't count. Also, if 9 occurs multiple times after 5, only the first instance would be counted.

The way I'm doing it is by trying to subtract a certain number from another number within a certain variable 'decile', by each 'id'. In variable 'decile' I want to subtract 5 from 9, to get 4, by each 'id'. This way I might be able to get what I'm looking for.

My data looks like this:

id decile new xx
MAR280450 6 . .
MAR280450 5 5 0
MAR280450 4 . .
MAR280700 9 9 4
MAR280700 5 5 0
MAR280700 2 . .
MAR280700 9 9 4
MAR280700 9 9 4
MAR280700 8 . .

Any kind of help would be greatly appreciated.

Thanks so much! :)

OUTREG "varlist not allowed", "option 3aster not allowed"

$
0
0
I ran

outreg x y z g using blahblah, blahblah

It told me

"varlist not allowed"

So I just deleted all variables and just put

outreg using blahblah, blahblah

It told me

"option 3aster not allowed"

I did "ssc install outreg" to correctly install it.

I even uninstalled every package by ado uninstall[1], ado uninstall[2] and so on

and then did "ssc install outreg" again but it didn't work.

Can anyone provide some intelligent guess about how to fix this?

Thank you in advance.

how to interpret marginal effects?

$
0
0
Hi there!

I am using some panel data to look at determinants of school attendance for 2 different years, 1995 and 2005. After running the regression, I have been suggested to compute the marginal effect to interpret the results.

Can you explain me what is the advantage of it?

Thanks very much!

belfagor

Extract State letters from string variable

$
0
0
Hi I have a variable that contains numbers and letters. Ideally, participants had to enter their first two state letter - ex. NY- following by certain numbers and letters.

1 NY12OPR
2 OH34789
3 FL3
4 45OHnmo56
5 ny1234

I would like to extract the first to letter of this string variable which is supposed to be the state. How can I do it in stata. There is another way to deal with this talking into account that some participants did not follow the correct format of entering their IDs such as participant 4 - which does not have their State letter at the beginning or 3 that have two blank spaces at the beginning?

Thank you!

Logistic errors in regression

$
0
0
Hello! I have some problems with this program. Can you help me a little bit? I need to use ologit and errors must be logistic. What is the code for this regression? Hope, anybody knows this.

Tabulate only the percentages

$
0
0
I am creating a table in en excel and I need only the percentages.
tab var1 var2

But I need only the percentages, not the frequencies.

Anyone?
Thanks!

Derived catergorical variable from two other catergorical variables.

$
0
0
Hello,
At present I have social class variables for both mum and dad but I want to create an overall variable : parental class. There are 6 categories – if I wanted to take forward the highest or lowest category to make the new derived variable, how would I go about doing that? I am relatively new to stata so have tried a few replace commands but can’t seem to get the right thing!
Thanks
Viewing all 800 articles
Browse latest View live