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

How to show the ENDOG results using OUTREG2 from INSTRUMENTAL REGRESSION?

$
0
0
Hello Stata users,

Does anybody know the command in OUTREG2 to show the ENDOG command results (i.e. test of endogeneity, over- and under identification results) from IVREGRESS (first stage) and/or IVREG2?

Thank you.

Kind regards,

Azreen Karim.

How to attribute a numeric value to a string variable through a loop

$
0
0
Hi all,

In my Dataset I have 12241 unique values, every individual is represented by the variable codind (it can appear in several lines) which is a string variable and I would like to have it as a numeric variable such that the first individual is called 1, the second one 2 until the last one called 12241. Here I add an example of the Dataset, in this case the first individual is 10001T0QF100100 and the second one 10002E0QF380100:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str15 codind
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10001T0QF100100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
"10002E0QF380100"
end
Thank you very much,
Pablo

r(3261) error message

$
0
0
Hi,


I'm using the stns command on STATA and I keep getting this error code "3261 non/class structure found where class/structure required?
netsurv():- function returned error
<istmt>: - function returned error

Does anyone know what this means? Sorry I'm relatively new to STATA so I dont understand what the error message means in plain terms.

Thank you

mixed effect models

$
0
0
Hi,

I'm trying to fit data from 10 different subjects to a nonlinear mixed effect model. The model is a sigmoid function with 4 parameters, all expected to be different from subject to subject, but whereas two of those parameters are drawn from a normal distribution and therefore can be replaced by population mean and population variability parameters (the mean and std of the normal distribution in question), the other two should be treated as subject-specific, rather than drawn from a normal distribution. That means that they should keep individual values for each subject.

Is this possible in Stata?

The function in question (for subject i) is:

Y_i(X) = Bottom_i + (Top_i-Bottom_i)/(1+10^((LogIC50_i-X)*HillSlope_i))

The LogIC50 and HillSlope parameters are normally distributed and I am interested in an estimate of their population means and variability, but the Top and Bottom parameter (defining the top and bottom of the sigmoid fit) can vary (fairly wildly) from subject to subject.

So the mixed effect model I'm trying to employ is

Y_i(X) = Bottom_i + (Top_i-Bottom_i)/(1+10^((LogIC50_mean + sigma_LogIC50*epsilon1_i-X)*(HillSlope_mean + sigma_HillSlope*epsilon2_i))

Any suggestions, short of renormalizing all data from Bottom-Top to 0-100%?

Cristian

multilevel logistic regression: question about random slope

$
0
0
Hello,
I have models of multilevel logistic regression with random intercept and random slope.
In the first model, with only random intercept, Stata gave me a variance component of the constant.
In the second model, with the slope, it supposed to show me two variation components: one of the constant and another one of the slope.
instead, I have only the component of the slope.
why? something not right with the command?

Random intercept model:

Code:
xtmelogit racist i.men i.academic_education agea i.religion religiosity_level  i.difficult_on_present_income i.ethnic_minority || cntry_numeric: , var mle
Array

Random intercept and slope model:

Code:
xtmelogit racist i.men i.academic_education agea i.religion religiosity_level  i.difficult_on_present_income i.ethnic_minority || cntry_numeric: r.men, var mle
Array

I would appriciate any help.
Thank you,
Shir

Altonji Ratio

$
0
0
Dear Stalisters,

I would be grateful if sombody could advice me on how to implement altonji ratio for non-linear models.

Regards,
Naveed

Panel spatial

$
0
0
Hello

I'm interesting to road a panel spatial with n=399 and t=12. In the stata 15 I use to do that the spxtregress command, but this method has the assumption of normality in errors. In the same way, in stata 13 I use xsmle, that addopted the same hypothesy. My problem is that my data dont have such errors distribution. There are an command in stata to road a panel spatial with gmm or IV.

Thanks for the any help

how to display frequencies and percentages to whole numbers only in STATA SE/15.1

$
0
0
Hi, 'm working with a data set of 58 variables and 795 observations. Most of the variables are categorical and I'm using the tab command to display frequencies.
Stata provides these results to 2 decimal places, but I would like to display them as whole numbers only or to one decimal point only. I want to ensure the calculation is done in stata rather than me rounding up which may lead to inaccuracies.

I am using the following commands:
tab lat
tab lat centre, column

I have tried the following format commands:
tab lat, column format(%9.1f)
tab alt, column format(%3.0f)

But I receive the error message "r(198)".

What command shall I use?

Example of data using dataex displayed below:

input str5 id byte(disp opcl lat centre)
"NG1" 2 2 1 1
"NG2" 2 2 1 1
"NG3" 2 2 2 1
"NG4" 1 2 2 1
"NG5" 2 2 1 1
"NG6" 2 2 1 1
"NG7" 2 2 1 1
"NG8" 2 2 1 1
"NG9" 2 2 1 1
"NG10" 2 2 1 1
"NGT11" 3 2 1 1
"NG12" 2 2 2 1
"NG13" 2 2 1 1
"NG14" 3 2 1 1
"NG15" 2 2 2 1
"NG16" 2 2 2 1
"NG17" 1 2 2 1
"NG18" 3 1 1 1
"NG19" 2 2 2 1
"NG20" 2 2 1 1
"NG21" 2 1 2 1
"NG22" 1 2 1 1
"NG23" 2 2 1 1
"NG24" 2 2 1 1
"NG25" 2 2 2 1
"NG26" 1 2 2 1
"NG27" 2 2 2 1
"NG28" 2 2 1 1
"NG29" 2 2 1 1
"NG30" 1 2 2 1
"NG31" 2 2 1 1
"NG32" 1 2 2 1
"NG33" 2 2 2 1
"NG35" 2 2 2 1
"NG36" 2 2 1 1
"NG37" 1 2 1 1
"NG38" 2 2 1 1
"NG39" 2 2 1 1
"NG40" 2 2 1 1
"NG41" 1 2 2 1
"NG42" 2 2 1 1
"NG43" 2 2 1 1
"NG44" 2 2 1 1
"NG45" 1 2 1 1
"NG46" 1 2 2 1
"NG47" 2 2 1 1
"NG48" 2 2 1 1
"NG49" 2 2 2 1
"NG50" 2 2 2 1
"NG51" 2 2 2 1
"NG52" 2 2 1 1
"NG53" 2 2 1 1
"NG54" 2 2 1 1
"NG55" 2 2 2 1
"NG56" 2 2 2 1
"NG57" 2 2 1 1
"NG58" 2 2 1 1
"NG59" 3 2 1 1
"NG60" 1 2 1 1
"NG61" 2 2 1 1
"NG62" 2 2 2 1
"NG63" 2 2 2 1
"NG64" 2 2 1 1
"NG65" 2 2 1 1
"NG66" 1 2 1 1
"NG67" 1 2 1 1
"NG68" 1 2 1 1
"NG69" 2 2 2 1
"NG70" 2 2 1 1
"NG71" 2 2 1 1
"NG72" 2 2 1 1
"NG73" 1 2 1 1
"NG74" 2 2 1 1
"NG75" 2 2 1 1
"NG76" 2 2 1 1
"NG77" 1 2 1 1
"NG78" 1 2 2 1
"NG79" 2 2 1 1
"NG80" 2 2 1 1
"NG81" 2 2 1 1
"NG82" 2 2 2 1
"NG83" 1 2 2 1
"NG84" 2 2 1 1
"NG85" 2 2 1 1
"NG86" 3 2 1 1
"NG87" 2 2 1 1
"NG88" 2 2 1 1
"NG89" 1 2 1 1
"NG90" 1 2 2 1
"NG91" 1 2 2 1
"NG92" 2 2 1 1
"NG93" 2 2 1 1
"NG94" 2 2 2 1
"NG95" 2 2 1 1
"NG96" 2 2 2 1
"NG97" 1 2 1 1
"NG98" 1 2 2 1
"NG99" 2 2 1 1
"NG100" 1 2 2 1
"NG101" 2 2 1 1
end
label values disp disp
label def disp 1 "undisplaced", modify
label def disp 2 "some", modify
label def disp 3 "marked", modify
label values opcl opcl
label def opcl 1 "open", modify
label def opcl 2 "closed", modify
label values lat lat
label def lat 1 "right", modify
label def lat 2 "left", modify
label values centre centre
label def centre 1 "Nottingham", modify
[/CODE]


Tables displayed using tab command attached as a picture.

Many thanks,

working with household survey data

$
0
0
I have a data-set which was captured for different houshold within a community it has 40,923 members and has 8,407 various households. Tha data contains Household Size (HHSIZE) and member number (MNO) each member of a houshold has a identify hhnsrrno
hhnsrrno. The HHSIZE needs to be consistent with number of individuals within a household but there are cases where the HHSIZE does not tally with number of individuals within the household. Please I will like to understand the command used to list only HHSIZE that do not tally with number of individulas within the household. Below is an extract of an output of such a command, I want to know what command was used to arrive at that out put. Note that the MNO (01 - 23) is a single househols with 23 members, the next count 01 - 13 is the next houshold with 13 members e.t.c. So what command was used to?
+------------------------------------------------+
| hhnsrrno mno hhsize |
|------------------------------------------------|
5091. | NC/NG/BOS/KUYI/1/036 01 6 |
5092. | NC/NG/BOS/KUYI/1/036 02 6 |
5093. | NC/NG/BOS/KUYI/1/036 03 6 |
5094. | NC/NG/BOS/KUYI/1/036 04 6 |
5095. | NC/NG/BOS/KUYI/1/036 05 6 |
|------------------------------------------------|
5096. | NC/NG/BOS/KUYI/1/036 06 6 |
5097. | NC/NG/BOS/KUYI/1/036 07 23 |
5098. | NC/NG/BOS/KUYI/1/036 08 23 |
5099. | NC/NG/BOS/KUYI/1/036 09 23 |
5100. | NC/NG/BOS/KUYI/1/036 10 23 |
|------------------------------------------------|
5101. | NC/NG/BOS/KUYI/1/036 11 23 |
5102. | NC/NG/BOS/KUYI/1/036 12 23 |
5103. | NC/NG/BOS/KUYI/1/036 13 23 |
5104. | NC/NG/BOS/KUYI/1/036 14 23 |
5105. | NC/NG/BOS/KUYI/1/036 15 23 |
|------------------------------------------------|
5106. | NC/NG/BOS/KUYI/1/036 16 23 |
5107. | NC/NG/BOS/KUYI/1/036 17 23 |
5108. | NC/NG/BOS/KUYI/1/036 18 23 |
5109. | NC/NG/BOS/KUYI/1/036 19 23 |
5110. | NC/NG/BOS/KUYI/1/036 20 23 |
|------------------------------------------------|
5111. | NC/NG/BOS/KUYI/1/036 21 23 |
5112. | NC/NG/BOS/KUYI/1/036 22 23 |
5113. | NC/NG/BOS/KUYI/1/036 23 23 |

5333. | NC/NG/BOS/NAKPANKUCHI/1/006 01 7 |
5334. | NC/NG/BOS/NAKPANKUCHI/1/006 02 13 |
|------------------------------------------------|
5335. | NC/NG/BOS/NAKPANKUCHI/1/006 03 13 |
5336. | NC/NG/BOS/NAKPANKUCHI/1/006 04 13 |
5337. | NC/NG/BOS/NAKPANKUCHI/1/006 05 13 |
5338. | NC/NG/BOS/NAKPANKUCHI/1/006 06 13 |
5339. | NC/NG/BOS/NAKPANKUCHI/1/006 07 13 |
|------------------------------------------------|
5340. | NC/NG/BOS/NAKPANKUCHI/1/006 08 13 |
5341. | NC/NG/BOS/NAKPANKUCHI/1/006 09 13 |
5342. | NC/NG/BOS/NAKPANKUCHI/1/006 10 13 |
5343. | NC/NG/BOS/NAKPANKUCHI/1/006 11 13 |
5344. | NC/NG/BOS/NAKPANKUCHI/1/006 12 13 |
|------------------------------------------------|
5345. | NC/NG/BOS/NAKPANKUCHI/1/006 13 13 |

9145. | NC/NG/GRA/DIKO/2/017 01 5 |
9146. | NC/NG/GRA/DIKO/2/017 02 5 |
9147. | NC/NG/GRA/DIKO/2/017 03 4 |
9148. | NC/NG/GRA/DIKO/2/017 04 4 |
|------------------------------------------------|
9149. | NC/NG/GRA/DIKO/2/017 05 5 |

9192. | NC/NG/GRA/DIKO/2/030 01 4 |
9193. | NC/NG/GRA/DIKO/2/030 02 6 |
9194. | NC/NG/GRA/DIKO/2/030 03 6 |
9195. | NC/NG/GRA/DIKO/2/030 04 6 |
|------------------------------------------------|
9196. | NC/NG/GRA/DIKO/2/030 05 6 |
9197. | NC/NG/GRA/DIKO/2/030 06 6 |

16647. | NC/NG/LVN/JIMA-YAFU/1/025 01 4 |
16648. | NC/NG/LVN/JIMA-YAFU/1/025 02 4 |
16649. | NC/NG/LVN/JIMA-YAFU/1/025 03 4 |
|------------------------------------------------|
16650. | NC/NG/LVN/JIMA-YAFU/1/025 04 4 |
16651. | NC/NG/LVN/JIMA-YAFU/1/025 05 5 |
24826. | NC/NG/MKW/LABEFU/1/023 01 4 |
24827. | NC/NG/MKW/LABEFU/1/023 02 6 |
24828. | NC/NG/MKW/LABEFU/1/023 03 4 |
|------------------------------------------------|


Chi-square test for equality of regression coefficients with panel data

$
0
0
Hello,

I am using panel data, with firm data where I analyze 13 determinants of ownership by investment funds. I have 15 years of data on approximately 8000 firms. My version of Stata is 14.0 (unfortunately I cannot update since I am using it at my university).

My basic (simplified) regression looks like this:
Code:
xtreg Ownership ESG FirmSize SalesGrowth, fe cluster(ID)
Now I would like to compare the coefficients of "ESG" from two different regressions, both with another dependent ownership variable, with a chi square test. I have attempted the following:
Code:
xtreg Ownership1 ESG FirmSize SalesGrowth, fe cluster(ID)
est store Option1
xtreg Ownership2 ESG FirmSize SalesGrowth, fe cluster(ID)
est store Option2
suest Option1 Option2
test ([Option1_mean]_b[ESG ] = [Option2_mean]_b[ESG ])
This code should work for 'normal' regressions, however in my case with panel data I get the error message: "xtreg is not supported by suest" r(322)
Does anybody know of an alternative method or a way around this?

Thanks in advance for any thoughts!

DiD - sample attrition, what if I impute missing data?

$
0
0
Hello,

I am estimating a treatment using differences-in-differences. The subjects in my treatment sample were allowed to drop out, which probably induced a bias in my estimate. I've been considering different methods for estimating a treatment effect on the treated, including LATE/CACE, but am having a difficult time finding how to apply these methods in a DiD framework.

Do you think it would be plausible to impute the "missing" observations after the treatment subjects dropped? The assumption would be that the subjects that dropped continued on the same trend they were on, and this would allow me to retain a full sample.

This wouldn't be a perfect estimate, of course, because it's possible that the subjects don't continue on their same path...and I worry that the variability of imputed values would be unrealistically small.

Any comments would be appreciated.

Thanks!

Axis manipulation in coefplot iwth multiple subgraphs

$
0
0
Hello Stata Users,
I have 4 different sets of regression coefficients that I would like to plot using coefplot. However, my coefficients have very different sizes and units. Is it possible to create different x-axes for every coefficient (while keeping the x-axes aligned, i.e. the tick for the value 0 is in the same place)?

What I would like to get is a graph like this example, only that there is a suitable x-axis for every variable. Is that possible? Thank you very much.

Array


My code to create the above graph:
Code:
sysuse auto ,clear

set seed 1234
gen dummy = (runiform()<0.5)

forval i = 0/1 {
    forval j = 0/1 {
        reg price mpg headroom weight length if foreign == `i' & dummy == `j' 
        est sto f`i'_d`j'
    }
}

coefplot  (f0_d0 ,label("dummy = 0")) (f0_d1 ,label("dummy = 1")) ,bylabel("domestic") ///
    || f1_d0 f1_d1 ,bylabel("foreign") || ///
    ,drop(_cons) xline(0)

Loop/Local Macro Not Working

$
0
0
Hello,

Recently I've been having a lot of trouble with local macros, especially when using them for loops. I don't see what I'm doing wrong as I have used loops and local macros successfully numerous times in the past. Here's the code from my do file:

Code:
 clear
 cls
 
 local input "C:\Users\~\Dropbox\Data"
 cd "$input"
 
 * 2002 Data
 
 local statelist AP MH
 foreach x of local statelist {
  import delimited "$input\2002\`x'\`x'_2002_AgData.csv", delimiter(comma)
  replace locid = trim(locid)
  save `x'_2002_AgData, replace
  
  clear
  
  import delimited "$input\2002\`x'\`x'_2002_ManufacData.csv", delimiter(comma)
  replace locid = trim(locid)
  save `x'_2002_ManufacData, replace
  
  clear
  
  use `x'_2002_AgData
  merge m:m locid using `x'_2002_ManufacData
  drop _merge
  save `x'_2002_AgManufac, replace
  
  }
which returns


file C:\Users\~\Dropbox\Data\2002_2002_AgData.csv not found
I don't understand why Stata is interpreting `x' to be 2002 rather than AP/MH. This is just one example of some problems I've been having with macros lately. Does anyone have an idea as to what I did wrong?

Thank you!

Convert Variable Values to Separate Variable

$
0
0
Hello,

I am part of a research team analyzing survey data regarding attitudes towards a specific health practice. Individuals were asked what is good or bad about a specific practice, and the answers were collected in a text format (open-ended). The research team then recoded these open-ended answers into specific categories. The recoded data looks like this - at least for some of the good reasons for the practice:

Code:
clear
input double id str70 FGCgood_Numeric
30 "26"
31 "26"
32 "26"
33 "14"
34 "21"
35 "21"
36 "19"
37 "26"
38 "26"
39 "26"
40 "26"
end
And here is summary of responses to this question to the question - that reflect the good reasons.


Code:
Practice Good ?
----------------------------------------------------------------------------------------------------
                                                       |      Freq.    Percent      Valid       Cum.
-------------------------------------------------------+--------------------------------------------
Valid   1  Cleanliness-Avoid Itching                   |          6       1.12       1.14       1.14
        2  Reglious Requirement-Ancestors, Gods, Koran |         13       2.42       2.46       3.60
        3  Bonding with peers                          |          2       0.37       0.38       3.98
        4  Teach Traditional Discipline                |          1       0.19       0.19       4.17
        5  Education-Teach Values                      |          8       1.49       1.52       5.68
        6  Socialization‎/Initiation‎/RitesPassage       |          9       1.67       1.70       7.39
        7  SelfIdentity‎/Makes you a woman‎/Respect      |          2       0.37       0.38       7.77
           Among Peers                                 |                                            
        9  CommunityCelebration-DanceMusicFood         |          8       1.49       1.52       9.28
        10 Culture Values and Practices                |          3       0.56       0.57       9.85
        11 Culture-Discipline‎/Teach Discipline         |          3       0.56       0.57      10.42
        12 Culture-DressPretty                         |          1       0.19       0.19      10.61
        13 Culture-Girls Excited                       |          1       0.19       0.19      10.80
        14 Culture-Girls trained for family life,      |         12       2.23       2.27      13.07
           better woman                                |                                            
        15 Culture-learn manners                       |          1       0.19       0.19      13.26
        16 Culture - Marriage                          |          1       0.19       0.19      13.45
        18 Culture-Moral and traditional training      |          2       0.37       0.38      13.83
        19 Maintains culture                           |         32       5.95       6.06      19.89
        21 Chastity‎/Chaste‎/Modesty                     |          6       1.12       1.14      21.02
        22 Tame Clitoris‎/ClitorisOvergows‎/Cant Hide    |          3       0.56       0.57      21.59
           Clitoris                                    |                                            
        23 Control‎/Reduce women's libido appetitie,    |         20       3.72       3.79      25.38
           premature sexuality                         |                                            
        24 Decrease‎/Prevent                            |         11       2.04       2.08      27.46
           Promiscuity‎/Fidelity‎/KeepOneMan             |                                            
        26 None‎/Dont Know‎/Not                          |        383      71.19      72.54     100.00
           Good‎/Nothing‎/Wrong‎/Mistake                  |                                            
        Total                                          |        528      98.14     100.00          
Missing .                                              |         10       1.86                      
Total                                                  |        538     100.00       
Now, I want to turn these individual responses into a series of variables that could ultimately be used to construct a scale that covers the reasons - both good and bad - in all about 50 reasons - a series of dummy variables, so to speak. In many cases, individuals give multiple good and bad reasons for the practice, we could go back into the data and code them.

Is there any way to achieve what I want here?

Once I create the series of single variables (that will represent statements that either agree or disagree with a reason, I will then run Factor Analysis to extract the underlying dimensions.

Thanks in advance for your assistance.

/cY

If not using strpos

$
0
0
Dear Stata community,
I am wondering if there is any command that allows me to do something similar to the following. I am using Stata 14.2
Code:
tab name if strpos(sector, "Held by") & strpos(sector, "Other Financial Corporations")
but instead of using & or | I want to use something similar to !=
Currently I am relying on strpos to refer to a certain sequences of string values in the variable sector.
Thus, I want to tabulate any country name for which a "Other Financial Sector" exists but not a "Held by..." sector but do not know how to formulate it or which command to use.
See my data below:

Code:
input str36 name str74 sector str3 sectorcode double(AT_T L_T)
"France" "Other Financial Corporations"                                "OFT"  7284600 0
"France" "Held by other financial institutions of which: Mutual funds" "OFM" 18706800 0
"Germany" "Other Financial Corporations"                                "OFT" 13658000 0
"Germany" "Held by other financial institutions of which: Mutual funds" "OFM" 14513400 0
"Germany" "Nonfinancial Corporations Households and NPISHs: Households" "HH"   1141200 0
"Hungary" "Other Financial Corporations"                                "OFT"  7284600 0
"Hungary" "Held by other financial institutions of which: Mutual funds" "OFM" 18706800 0


I had a look at the Stata help manual and stataforum but haven not seen any solution to a problem like this.

Thank you very much
Alexander Marx

How to generate each year's data from a time period?

$
0
0
Dear fellow stata users,

Hello!

I've downloaded the data about S&P 500 constituents from wrds, the variables "from" and "thru" describes the beginning and ending time of when the firm is in S&P 500.
But how can I find out that through the time period of 1996 to 2014, of every specific year which firms are in the S&P 500?
(to generate the yearly S&P 500 constituents)

Here's part of my data

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 gvkey str4 iid str6 gvkeyx long(from thru) str58 conm str10 indextype str8(tic spii spmi) str10 indexcat str58 co_conm str8 co_tic str10(co_cusip co_cik) str4 co_sic str6 co_naics
"001078" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "ABBOTT LABORATORIES"         "ABT" "002824100" "0000001800" "2834" "325412"
"001300" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "HONEYWELL INTERNATIONAL INC" "HON" "438516106" "0000773840" "9997" "336413"
"001440" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "AMERICAN ELECTRIC POWER CO"  "AEP" "025537101" "0000004904" "4911" "2211"  
"002285" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "BOEING CO"                   "BA"  "097023105" "0000012927" "3721" "336411"
"002403" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "BRISTOL-MYERS SQUIBB CO"     "BMY" "110122108" "0000014272" "2834" "325412"
"002663" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "CAMPBELL SOUP CO"            "CPB" "134429109" "0000016732" "2030" "311422"
"002817" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "CATERPILLAR INC"             "CAT" "149123101" "0000018230" "3531" "333120"
"002991" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "CHEVRON CORP"                "CVX" "166764100" "0000093410" "2911" "324110"
"003144" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "COCA-COLA CO"                "KO"  "191216100" "0000021344" "2086" "312111"
"003170" "01" "000003" 1551 . "S&P 500 Comp-Ltd" "LGCAP" "I0003" "" "10" "S&P" "COLGATE-PALMOLIVE CO"        "CL"  "194162103" "0000021665" "2844" "325611"
end
format %d from
format %d thru






Thanks in advance.

Best,

Noah




autocomplete shortcuts in Stata16

$
0
0
Dear Stata users,
It's a good news that Stata 16 support autocompletion in dofile editor. The autocompletion practice is done with "Enter" key (Hard Return). However, someone maybe like to use the "Space" key to do autocompletion. Can we change keyboard shortcuts in WindowsOS?
Discussion about MacOS:
https://www.statalist.org/forums/for...t-keys-for-mac

Compare value in a cell with previous values in a panel data

$
0
0
Hi guys - Need some help with comparing a value in a cell with previous values in a panel data. The is an inventor-year panel with a variable subclass that describes the subclasses in which each inventor was granted patent each year. The data looks something like this:

inventor year patent subclass
10069 1982 4346109 859
10069 1983 4382151 875
10069 1983 4386227 219
10069 1984 4481217 894
10069 1984 4468458 134
10069 1984 4435423 927
10069 1984 4454126 41
10069 1984 4454330 497
10069 1984 4454330 219
10069 1984 4455316 419
10069 1984 4482734 960
10069 1985 4522759 821
10069 1985 4491592 560
10069 1986 4571408 134
10069 1986 4599328 134
10069 1986 4603126 739
10069 1986 4613593 106
10069 1986 4576963 532
10069 1987 4655973 35
10069 1987 4639450 176

I want to compare values in the subclass and identify if the inventor has used the subclass in the previous 4 years and if yes, generate a new variable that will return 1 and 0 otherwise. For example, the new variable, i,e., old subclass should return value of 1 if the inventor has used the subclasses in the last 4 years and 0 otherwise. To take an example from the table above, the old subclass variable should generate 1 for the green entry as the inventor has used the subclass 134 within last 4 years (1984) and 0 for red entry has the inventor has not used subclass 106 within previous 4 years. Hope you will be able to help.

Best
Rajat


Bug in autocompletion?

$
0
0
Version 16 of Stata now has autocompletion implemented in the do-editor. There is one aspect of it that I find problematic and that, I think is a bug. It pertains to the automatic insertion of closing braces and quotes. When used with ", (, {, or [ it seems to work fine: you type the opening character, and a balancing closing character appears. When you reach the end of the content that goes between them, you can either reposition the cursor after the closing character, or you can actually type the closing character and Stata will recognize what you are doing and will not insert an extra ", ), }, or ]. This works even when things are fairly deeply nested.

When you start a reference to a local macro with `, the closing ' is automatically inserted. So far, so good. But when you reach the end of the name of the macro, if you type ', Stata does not seem to recognize that you have just balanced the `. Instead, it now inserts an additional ' character which you then have to delete! Given the frequency with which I use local macros, I'm finding this a real pain. I've tried to think of some rationales for why this might be intentional design, but haven't come up with any. I think it's a bug.

Any other thoughts? Anybody know a workaround (other than turning off balancing altogether--which I don't want to do)?

Added:
Code:
. about

Stata/MP 16.0 for Windows (64-bit x86-64)
Revision 02 Jul 2019
Copyright 1985-2019 StataCorp LLC

Total physical memory:        8.00 GB
Available physical memory:    1.50 GB

Single-user 4-core Stata perpetual license:

interpreting the interaction effects of odds ratios in femlogit

$
0
0
I am using a fixed effects multinomial logit model (femlogit) with interaction terms. There are three possible outcomes, with outcome(1) being the baseline/default. I have an interaction between two continuous variables, and I am unsure how to interpret the odds ratios, especially since the odds ratios associated with the interacted variables' main effects really jump around. I understand that being a ratio means such fluctuations are possible, but I am:

1) concerned that the fluctuations somehow mean something is "wrong", and
2) unsure how to make sense of the two main effects plus the interaction.

Code:
femlogit f.y x1-x10 x1*x2, robust or
A few things: femlogit doesn't allow operators like "#", so interaction terms need to be calculated by hand (hence "x1*x2" as the interaction here). Next, x1 is log transformed.

I'm not reproducing the entire output, but here's what the odds ratios of interest look like in the case of outcome 3 (relative to outcome 1):

x1 1.04* 1.04*
-1.99 -2.04
x2 0.24 1.04e+06*
(-0.70) -2.34
x3 11.52 7.53
-0.82 -0.67
x4 0.42* 0.44*
(-2.56) (-2.45)
x5 0.94 0.98
(-0.29) (-0.10)
x6 0.92 0.92
(-0.93) (-0.93)
x7 0.92 1.02
(-0.01) 0
x8 0.02 0.03
(-1.25) (-1.15)
x9 1 0.99
(-0.06) (-0.10)
x10 1.72** 1.74**
-10.48 -10.6
x1*x2 0.16**
(-2.80)

As said, the odds ratio for x2 has me concerned. As for the interaction term, I read a post by Maarten Buis in a related thread in which he said the way to interpret the interaction effect is to calculate it across a meaningful range of x1 or x2 (I guess either). If I were interested in -1SD to +1 SD for x1, that range would be 5 (like I said, this is a log-transformed currency based value). That would mean like di (exp(_b[c.x1#c.x2]*5)-1)*100 = 25%. That is certainly interesting, if true. But what about the ORs for x1 and x2 in isolation? Are they not to be included in this calculation somehow?

Sorry if this is really basic. If anyone has a simple formula for how to explain the relationships of interest in a straightforward yet meaningful way, I'm all ears.
Viewing all 72776 articles
Browse latest View live


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