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

how to generate number of children, working children, child labour?

$
0
0
Hey! I am using the dataset Household Income and Expenditure Survey (HIES) 2016 of Bangladesh and I want to generate how many numbers of children are there and also the working children according to the ILO definition and child labour. My datasets consist of hhold (household code), hhid (household identification), S1aq02 (relationships of the members with the head of the household) this variable is lumped, age, sex, earner(Yes/No), were you paid on a daily basis? (Yes/No), did you work for livelihood during the past 7 days? (Yes/No), were you available for work during the past 7 days? (Yes/No), did you looking for work during the past 7 days? (Yes/No),
Why were you not available/ did you not looking for work?
01 Engaged in domestic work
02 Housewife
03 Student
04 Too old/ retired
05 too young
06 temporarily sick
07 Disabled
08 Waiting to start a new job
09 No work available
10 On leave/looking for job/business
11 Other (Specify)
Can anyone help me?

Singularity, categorical variable, GWR

$
0
0
Dear all,

I am writing with regard to a message error that I encounter when I regress a geographically weighted model while including dummies variables. The error message is the following : "matrix not positive definite'. It disappear when I suppress the categorical variables and reappear when I include one. Can you help me please ?

Thank you a lot !

PS : I can make classical regression (OLS) without any problem.

testing indirect effect of non-linear mediation

$
0
0
SPSS and SAS has such macros to realize such functions using bootstrap method, how can Stata fulfill this. It should be easy for coders. Can anyone help me write the ado file? Thanks a lot and thanks for your kind help. The attached is a paper that may be helpful.

Wald chi-square values of coefficients in logit procedures

$
0
0
Dear Madam/Sir,

Is there any option in logit / xtlogit procedures to report Wald Chi-square values instead of Z-values for coefficients and intercepts?

Thank you so much in advance for your help.

Sincerely,
HJ

total

$
0
0
Hi,
I have 3 variables (var1 var2 var3) each with 5 categories (1, 2, 3, 4 & 5).
I would like to create a variable, var4, showing overall total counts of the observations in 1's, 2's, 3's, 4's and 5's combined.
so that command tab var4 will give 1 (being sum of, 1 of var1 + 1 of var2 + 1 of var3) and 2 (being sum of, 2 of var1 + 2 of var2 + 2 of var3)...

and at the end, the overall mean and standard deviation of var4.

Thank you in advance,
Immac

showing the whole number for numerical variables

$
0
0
Hi there,

I have to combine the values of two numerical variables into a value in a new numerical variable, the new one will have 11 or 12 digits. For example, put 8497 and 2171205 together, the new numerical variable should show as 84972171205, but it shows as scientific notation, like 8.497e+10. I tried command "format var %12.0f", it turns out to be 84972167168.

I cannot do "destring" because this variable has to be numerical, and I do not need this variable get round up or down, because it just means ID number for an observation, is there any command can help me to show the whole number in the data editor without generating a new variable? Just replace the scientific notation with the whole number.

Thanks a lot!

Transforming a square matrix to three variables (row, column and value)

$
0
0
Hi,

I am trying to transform a matrix into three variables: row number, column number, and matrix value (value referring to every row-column combination). Is there an efficient way of doing it in Stata?
Please find below an example of the transformation using a 15*15 matrix

Input matrix:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)
 2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
 3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
 6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
 7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
 8  9 10 11 12 13 14 15 16 17 18 19 20 21 22
 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
 5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
 7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
end
I declared the matrix with the command:

Code:
mkmat x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 , matrix(A)

Here is the desired transformation:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(row column valeur)
1  1  2
1  2  3
1  3  4
1  4  5
1  5  6
1  6  7
1  7  8
1  8  9
1  9 10
1 10 11
1 11 12
1 12 13
1 13 14
1 14 15
1 15 16
2  1  3
2  2  4
2  3  5
2  4  6
2  5  7
2  6  8
2  7  9
2  8 10
2  9 11
2 10 12
2 11 13
2 12 14
2 13 15
2 14 16
2 15 17
3  1  4
3  2  5
3  3  6
3  4  7
3  5  8
3  6  9
3  7 10
3  8 11
3  9 12
3 10 13
3 11 14
3 12 15
3 13 16
3 14 17
3 15 18
4  1  4
4  2  5
4  3  6
4  4  7
4  5  8
4  6  9
4  7 10
4  8 11
4  9 12
4 10 13
4 11 14
4 12 15
4 13 16
4 14 17
4 15 18
5  1  6
5  2  7
5  3  8
5  4  9
5  5 10
5  6 11
5  7 12
5  8 13
5  9 14
5 10 15
5 11 16
5 12 17
5 13 18
5 14 19
5 15 20
6  1  7
6  2  8
6  3  9
6  4 10
6  5 11
6  6 12
6  7 13
6  8 14
6  9 15
6 10 16
6 11 17
6 12 18
6 13 19
6 14 20
6 15 21
7  1  8
7  2  9
7  3 10
7  4 11
7  5 12
7  6 13
7  7 14
7  8 15
7  9 16
7 10 17
end
Best regards,

replacing values of a new variable with valid values of other variables

$
0
0
Hi,
I would like to generate a new variable and fill the new variable with the valid values from a list of variables named as exceeds_TLE_*. In fact, all the valid values in the exceeds_TLE_* have a diagonal form and can be combined in a single variable. Below please see what I tried.
Thanks.
Nader

local `TLE_exceed' exceeds_TLE_*
gen TLE_combined=.
replace TLE_combined=`TLE_exceed' if `TLE_exceed'~=. & TLE_combined==.


smoothing lines

$
0
0
Dear Stata users,

I am using Stata 15 and trying to plot changes in sb1 vs years by age-groups (4 different models). This graph that I plotted makes artifacts (not smooth lines). I am wondering how to construct plots with nice smooth lines?

Here is the code used to draw the graph:
PHP Code:
set scheme s1color
tw  
(lowess sb1 yrs if age_gr==1sort lcolor(blue)) ///
    
(lowess sb1 yrs if age_gr==2sort lcolor(orange)) ///
    
(lowess sb1 yrs if age_gr==3sort lcolor(green)) ///
    
(lowess sb1 yrs if age_gr==4sort lcolor(cranberry)) /// 
    
(lowess sb1 yrs if age_gr==5sort lcolor(yellow)) ||, by(modelcol(2compact)  ///
     
ylab(---1  0 1)  xlab(0 5 10 15 20 25 30 35///
     
leg(allxtitle("years"ytitle("change isn sb1"///
     
ylab(, gridyline(0xsize(6ysize(4.5

Thank you very much
Oyun
Array

How to extract the last seven digits of nine-digits numbers?

$
0
0
I'm having problems trying to extract digits from numbers.

My dataset has a variable called "municipio", which contains nive digits (see data sample below)

I need to extract the last seven digits in order to obtain Brazilian municipalities' IDs.

Example:

For the municipality of "Franca", "municipio" value is 153516200

What I need: to remove 15 and obtain 3516200. And so on for all municipalities

How can that be done?

Thank you


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int idnum byte pais int estratopri float(ibge_uf_code ibge_mun_code) str2 braprov int prov str23 bramunicipio long municipio
  1 15 1504 35 . "SP" 1535 "Franca"              153516200
  2 15 1504 35 . "SP" 1535 "Franca"              153516200
  3 15 1504 35 . "SP" 1535 "Franca"              153516200
  4 15 1504 35 . "SP" 1535 "Franca"              153516200
  5 15 1504 35 . "SP" 1535 "Franca"              153516200
  6 15 1504 35 . "SP" 1535 "Franca"              153516200
  7 15 1504 35 . "SP" 1535 "Franca"              153516200
  8 15 1504 35 . "SP" 1535 "Franca"              153516200
  9 15 1504 35 . "SP" 1535 "Franca"              153516200
 10 15 1504 35 . "SP" 1535 "Franca"              153516200
 11 15 1504 35 . "SP" 1535 "Franca"              153516200
 12 15 1504 35 . "SP" 1535 "Franca"              153516200
 13 15 1504 35 . "SP" 1535 "Franca"              153516200
 14 15 1504 35 . "SP" 1535 "Franca"              153516200
 15 15 1504 35 . "SP" 1535 "Franca"              153516200
 16 15 1504 35 . "SP" 1535 "Franca"              153516200
 17 15 1504 35 . "SP" 1535 "Franca"              153516200
 18 15 1504 35 . "SP" 1535 "Franca"              153516200
 19 15 1504 35 . "SP" 1535 "Franca"              153516200
 20 15 1504 35 . "SP" 1535 "Franca"              153516200
 21 15 1504 35 . "SP" 1535 "Franca"              153516200
 22 15 1504 35 . "SP" 1535 "Franca"              153516200
 23 15 1504 35 . "SP" 1535 "Franca"              153516200
 24 15 1504 35 . "SP" 1535 "Franca"              153516200
 25 15 1504 35 . "SP" 1535 "Franca"              153516200
 26 15 1504 35 . "SP" 1535 "Franca"              153516200
 27 15 1504 35 . "SP" 1535 "Franca"              153516200
 28 15 1504 35 . "SP" 1535 "Franca"              153516200
 29 15 1504 35 . "SP" 1535 "Franca"              153516200
 30 15 1504 35 . "SP" 1535 "Franca"              153516200
 31 15 1504 35 . "SP" 1535 "Franca"              153516200
 32 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 33 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 34 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 35 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 36 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 37 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 38 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 39 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 40 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 41 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 42 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 43 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 44 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 45 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 46 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 47 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 48 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 49 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 50 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 51 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 52 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 53 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 54 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 55 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 56 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 57 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 58 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 59 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 60 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 61 15 1504 35 . "SP" 1535 "S�o Jose dos Campos" 153549904
 62 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 63 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 64 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 65 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 66 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 67 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 68 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 69 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 70 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 71 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 72 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 73 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 74 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 75 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 76 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 77 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 78 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 79 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 80 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 81 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 82 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 83 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 84 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 85 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 86 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 87 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 88 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 89 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 90 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 91 15 1504 35 . "SP" 1535 "Narandiba"           153532207
 92 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 93 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 94 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 95 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 96 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 97 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 98 15 1505 42 . "SC" 1542 "Blumenau"            154202404
 99 15 1505 42 . "SC" 1542 "Blumenau"            154202404
100 15 1505 42 . "SC" 1542 "Blumenau"            154202404
end
label values estratopri estratopri
label def estratopri 1504 "Sudeste", modify
label def estratopri 1505 "Sul", modify
label values prov prov
label def prov 1535 "S�o Paulo", modify
label def prov 1542 "Santa Catarina", modify
label values municipio municipio
label def municipio 153516200 "Franca", modify
label def municipio 153532207 "Narandiba", modify
label def municipio 153549904 "S�o Jos� dos Campos", modify
label def municipio 154202404 "Blumenau", modify

address the endogeneity issue

$
0
0
Hi all!

I want to address the endogeneity issue in my paper.

I have panel data (gvkey and fyear). I create RTW indicator for states that adopted RTW laws.

I also create ChangeRTW to construct a treatment variable, which is a dummy taking the value of one if the firm (gvkey) is located in a certain state which will adopt RTW during my sample period (many states have already adopted this law before my sample period). I then create a dummy, Post, which is one after the adoption year.

For those states that already adopted this law:
gen RTW=state=="AL"|state=="AZ"|state=="AR"|state=="FL "|state=="GA"|state=="ID"|state=="IA"|state=="KS"| state=="LA"|state=="MS"|state=="NE"|state=="NV"|st ate=="NC"|state=="ND"|state=="OK"|state=="SC"|stat e=="SD"|state=="TN"|state=="TX"|state=="UT"|state= ="VA"|state=="WY"

For the states that adopt this law during my sample period:
replace RTW=1 if state=="IN" & fyear>2011
replace RTW=1 if state=="MI" & fyear>2011

gen ChangeRTW=state=="IN"|state=="MI"
gen Post=fyear>2011 if state=="IN"|state=="MI" (##not sure if I should use this instead: Post=fyear>2011)
replace Post=0 if Post==.

What are the best ways to create this difference in difference regression? Should I use something like the following one?

reg DependentVar ChangeRTW*Post*IndependentVar ChangeRTW Post IndependentVar Controls (model 1)

or reg DependentVar RTW*IndependentVar RTW IndependentVar Controls (model 2)


The results using model 1: I have three sets of statistics under ChangeRTW*Post*IndependentVar, 0 0; 1 0 ; 1 1. But the stats for 1 0 is empty. Why do I get this empty stats?

Similarly, the results using model 2: two sets of stats under RTW*IndependentVar, 0 and 1, but empty stats in the 1 group. Anyone can help me understand this issue?


Any advice on how to address the endogeneity issue or how to use difference-in-difference will be greatly appreciated!

See below for my data:

----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double permno long(gvkey datadate) double fyear float(RTW ChangeRTW Post)
54594 1004 15399 2001 0 0 0
54594 1004 15583 2002 0 0 0
54594 1004 16130 2003 0 0 0
54594 1004 16495 2004 0 0 0
54594 1004 16770 2005 0 0 0
54594 1004 17044 2006 0 0 0
54594 1004 17683 2007 0 0 0
54594 1004 17775 2008 0 0 0
54594 1004 18231 2009 0 0 0
54594 1004 18596 2010 0 0 0
54594 1004 18961 2011 0 0 0
54594 1004 19327 2012 0 0 0
54594 1004 19601 2013 0 0 0
54594 1004 20057 2014 0 0 0
54594 1004 20605 2015 0 0 0
54594 1004 20788 2016 0 0 0
21020 1045 15521 2002 1 0 0
21020 1045 16070 2003 1 0 0
21020 1045 16161 2004 1 0 0
21020 1045 16709 2005 1 0 0
21020 1045 16891 2006 1 0 0
21020 1045 17347 2007 1 0 0
21020 1045 17713 2008 1 0 0
21020 1045 18170 2009 1 0 0
21020 1045 18443 2010 1 0 0
21020 1045 18717 2011 1 0 0
21020 1045 19723 2013 1 0 0
21020 1045 19904 2014 1 0 0
21020 1045 20453 2015 1 0 0
21020 1045 20544 2016 1 0 0
21020 1045 20909 2017 1 0 0
11499 1050 17074 2006 1 0 0
11499 1050 17531 2007 1 0 0
11499 1050 17897 2008 1 0 0
11499 1050 18078 2009 1 0 0
11499 1050 18627 2010 1 0 0
11499 1050 18992 2011 1 0 0
11499 1050 19174 2012 1 0 0
11499 1050 19723 2013 1 0 0
11499 1050 19813 2014 1 0 0
11499 1050 20178 2015 1 0 0
11499 1050 21000 2017 1 0 0
81912 1072 15613 2002 1 0 0
81912 1072 16070 2003 1 0 0
81912 1072 16436 2004 1 0 0
81912 1072 16891 2005 1 0 0
81912 1072 17256 2006 1 0 0
81912 1072 17531 2007 1 0 0
81912 1072 17805 2008 1 0 0
81912 1072 18170 2009 1 0 0
81912 1072 18535 2010 1 0 0
81912 1072 18992 2011 1 0 0
81912 1072 19266 2012 1 0 0
81912 1072 19539 2013 1 0 0
81912 1072 19904 2014 1 0 0
81912 1072 20361 2015 1 0 0
81912 1072 20727 2016 1 0 0
81912 1072 21000 2017 1 0 0
27991 1075 15613 2002 1 0 0
27991 1075 15978 2003 1 0 0
27991 1075 16252 2004 1 0 0
27991 1075 16526 2005 1 0 0
27991 1075 17166 2006 1 0 0
27991 1075 17439 2007 1 0 0
27991 1075 17713 2008 1 0 0
27991 1075 17987 2009 1 0 0
27991 1075 18352 2010 1 0 0
27991 1075 18992 2011 1 0 0
27991 1075 19174 2012 1 0 0
27991 1075 19539 2013 1 0 0
27991 1075 19813 2014 1 0 0
27991 1075 20178 2015 1 0 0
27991 1075 20727 2016 1 0 0
27991 1075 21000 2017 1 0 0
10517 1076 15430 2002 1 0 0
10517 1076 15978 2003 1 0 0
10517 1076 16436 2004 1 0 0
10517 1076 16801 2005 1 0 0
10517 1076 17166 2006 1 0 0
10517 1076 17256 2007 1 0 0
10517 1076 17897 2008 1 0 0
10517 1076 18170 2009 1 0 0
10517 1076 18535 2010 1 0 0
10517 1076 18717 2011 1 0 0
10517 1076 19174 2012 1 0 0
10517 1076 19631 2013 1 0 0
10517 1076 20088 2014 1 0 0
10517 1076 20453 2015 1 0 0
10517 1076 20727 2016 1 0 0
10517 1076 21000 2017 1 0 0
20482 1078 15705 2002 0 0 0
20482 1078 15795 2003 0 0 0
20482 1078 16344 2004 0 0 0
20482 1078 16709 2005 0 0 0
20482 1078 16982 2006 0 0 0
20482 1078 17256 2007 0 0 0
20482 1078 17897 2008 0 0 0
20482 1078 18262 2009 0 0 0
20482 1078 18535 2010 0 0 0
20482 1078 18992 2011 0 0 0
end
format %d datadate
------------------ copy up to and including the previous line ------------------



Panel data: Multiple observations per year

$
0
0
Hi,

I'm new to STATA and its commands so excuse my inexperience. My dataset contains multiple observations per ID. In a simplistic way, it looks like this (with made-up numbers):
ID Time ROE Turnover Age Board_gender
1 2012 25,4 1234 43 M
1 2012 53 M
1 2012 34 F
1 2013 24,1 3402 45 M
1 2013 54 F
1 2013 43 F
1 2013 44 F
1 2013 34 M
1 2014 33,1 3500 63 M
1 2014 52 F
1 2015 32,2 3478 41 M
1 2015 38 M
1 2015 57 M
1 2015 42 F
2 2012 24,5 4350 36 F
2 2012 61 M
2 2013 33,4 4590 43 M
2 2013 45 M
2 2013 51 M
...And so on. I have +5000 ID's.

I really want to do some pooled OLS, FE, IV ect., but my data is highly unbalanced and I get "repeated time values within panel".
My parameters of interest are ROE and Turnover, and I want to know the effect of Board_gender and Age on these parameters. Do I have to replace all Board_gender variables with a number, such that I only have one observation per year? (same with gender). Or am I able to apply STATA-tricks without deleting rows?

Thank you so much in advance!

Selmlog command (selection bias correction based on multinomial logit)

$
0
0
Dear Stata professionals,
Even after reading the manual for the implementation of the selmlog command I still cannot get the results straight. I would appreciate your ideas and solutions on the following problem. The general idea is to see whether and how voluntary audit affects firms cost of debt. To check that, I need to correct for the self-selection bias of the companies in engaging in voluntary audit.
The current setting I have is:
My selection model (at first I perform Heckman) tries to describe the firms in my sample that are willing to engage in "voluntary_audit", hence the dependent variable of the selection model is a binomial (0 or 1) and I control it on various control variables. for example: v_audit = size + exports + etc.
In the outcome regression I have the cost of debt variable, which in my case is "interest rate", as dependent variable plus a set of control variables -different from the controls in the selection model.
Since the selmlog manual says that the selection regression dependent variable needs to have more than 2 options, I created a new variable which combines whether a firm can choose between engaging in voluntary audit and if it does, whether it chooses big4 auditor. So this new variable has 0,1,2 values. Then the whole setting looks like:
----- selmlog irate x1 x2 x3 x4, select(the new variable with 0,1,2 values = the controls from the selection model as I mentioned above) dfm (2) bootstrap(100)

The problem that appears is having "non-missing values" and "cannot find varlist_m". I would appreciate if someone can help me around this! Thanks

Relative risk ratio

$
0
0
how to interpret relative risk ratio in multinomial logistic regression. Also, what is the difference in using odd ratio or RRR to interpret in multinomial logistic regression

Interraction effect

$
0
0
stata command for running interraction effects of two independent variables on one dependent variables with three levels. e.g interraction effects living arrangement and support network on quality of life

Counting using loop members of the same household during a specific time period.

$
0
0
Hi everyone,

So I'm using Stata 12.0 and currently working on a dataset with around 500,000 indivs, 7000 of these idivs are "enrolled". I want to determine for my enrolled indivs, how many idivs out of the whole pop share a house id with the enrolled idiv at a specific date.
The dataset is setup in a wide format, each indiv has a houseid1 with start and end dates of the residency, if they moved then they have a second house id (houseid2) with start and end dates for that as well, and so on..
I've determined the enrolled houseid's (houseid_enrolled) and the date of interest and want to loop through each of the variables list (houseid1, houseid2, houseid3...) for all the participants to determine how many people lived at the enrolled house on the specific date. For some indivs this could be their houseid1 or houseid2 and so on, below is the code I've gotten so far currently the count is not adding up and just counting 1 for each enrolled houseid.
My plan was to then sum the num_house*_members for each enrolled indiv after to get the total living at one house during the time, if there is a cleaner method that would also be appreciated.
I'm aware I could just create separate datasets and merge on the houseid variables and count them that way but Im looking to learn how to do this in a more efficient way.

Thanks, dont forgot to wash your hands!
Ben

code so far
Code:
gen num_house1_members=0
gen num_house2_members=0
gen num_house3_members=0
forvalues i=1/3 {
foreach v of var houseid`i'{
    replace num_house`i'_members=[num_house`i'_members+1] if `v'==houseid_enrol  &  inrange(date,strtdate`i',enddate`i')
    }    
}
Dataset

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float obs double houseid_enrol float date double(houseid1 houseid2) float(strtdate1 enddate1)
293437           . 21527           .           . 21191     .
258630           . 21675           .           .     .     .
248761           .     .           .           .     .     .
153093           .     . 64006010101           . 18628     .
411306           .     . 64006010101           . 20287 21143
163275           . 21682 64006006901           .     .     .
422822           . 21724 64006010101           .     .     .
     1 64006010101 21836 64006010101           . 21653     .
106823           .     . 64006010201           . 18628 20691
407350           .     . 64006010201           . 18628     .
360936           .     . 64006010201           . 19486     .
176415           .     . 64006010201           . 20381     .
305027           .     . 64006010201           . 20781     .
263907           .     . 64006010201           . 21864     .
     2 64006010201 21906 64006010201           .     .     .
 57961           .     . 64006010301           . 18628 18999
 36251           .     . 64006010301           . 18628     .
 65297           .     . 64006010501           . 20792     .
 94142           .     . 64006010501           . 21246     .
end
format %td date
format %tddd_Mon_CCYY strtdate1
format %tddd_Mon_CCYY enddate1

"not sorted" after predict u command on panel frontier model

$
0
0
Hi, I am developing a frontier model but am unable to predict inefficiency and efficiency values. Below I've copied my instructions:

. xtfrontier frlabreg edu gdppcavg d.act year, ti

[results ommitted for simplicity]

. sort countrynum

. predict fcastti, xb
(36 missing values generated)

. predict inefti, u
not sorted
r(5);


Can you help?
Many thanks

Counting observations by group adjusting over time

$
0
0
Dear Forum,

first of all thank you for all previous answers you have provided - I would hav finished no project so far without your help.
I am currently facing a problem about counting observations, but could not find an answer in the forum so far. Possibly you could help?

My problem is the following.
I have a data set with investments of firms into companies over years. I am seeking to count the number of previous and current investments a firm has made (the variable thus changes over time). For example (see data below): I want for fund "a" a variable that counts the number of investment made in THIS AND IN PREVIOUS years. For example in 2001 it made two investments, in 2002 another two investments (combined with +2 from the previous years) etc.
I was thinking about doing this with a loop, but am unsure about it?

Help is very much appreciated!
Thank you very much!

Silke

Sample data:
Company Firm Year Variable I want
qw a 2001 2
ef a 2001 2
sg a 2002 4
rh a 2002 4
yf a 2008 5
ff a 2012 7
kr b 2012 7
fg b 2001 1
fj b 2002 2
ki b 2007 3

Batch convert RTF to Word DOCX format

$
0
0
Is there a way to convert (in batch, programmatically) RTF to DOCX files? My preference would be to use a Stata-based solution but I would accept any Linux/UNIX or Windows based solutions. I have not been successful with some Googling this morning.

Multicollinearity: vif with or without uncentered

$
0
0
I am using the vif command to test for multicollinearity, however I can't seem to underestand the difference between a regular -vif command and a -vif, uncentered? They give me this output:
Array

Two very different results. Do I just roll with the regular vif command or do I have a problem because of the VIF value exceeding 10 at the uncentered one?

Kind regards!
Viewing all 65184 articles
Browse latest View live


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