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

Replace strings

$
0
0
Hi all,

I have a database as the following:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4(atc3n atc3) str93 atc_description
"A01A" "A1A" "Stomatologicals"                                                                              
"A01B" "A1B" "Mouth Antifungals"                                                                            
"A02B" "A2B" "Acid Pump Inhibitors"                                                                         
"A02B" "A2B" "All Other Antiulcerants"                                                                      
"A02B" "A2B" "Bismuth Antiulcerants"                                                                        
"A02B" "A2B" "H2 Antagonists"                                                                               
"A02B" "A2B" "Prostaglandin Antiulcerants"                                                                  
"A03A" "A3A" "Plain Antispasmodics And Anticholinergics"                                                    
"A3F"  "A3F" "Gastroprokinetics"                                                                            
"A3G"  "A3G" "Gastro-intestinal Sensorimotor Modulators"                                                    
"A4A"  "A4A" "Other Antiemetics And Antinauseants"                                                          
"A4A"  "A4A" "Serotonin Antagonist Antiemetics/Antinauseants"                                               
"A5A"  "A5A" "Bile Therapy And Cholagogues"                                                                 
"A5B"  "A5B" "Hepatic Protectors"                                                                           
"A6A"  "A6A" "Osmotic Laxatives"                                                                            
"A6A"  "A6A" "Other Drugs For Constipation"                                                                 
"A6A"  "A6A" "Stimulant Laxatives"                                                                          
"A7A"  "A7A" "Intestinal Anti-infective Antidiarrhoeals"                                                    
"A7B"  "A7B" "Intestinal Adsorbent Antidiarrhoeals"                                                         
"A7E"  "A7E" "Intestinal Anti-inflammatory Agents"                                                          
"A7F"  "A7F" "Antidiarrhoeal Micro-organisms"                                                               
"A7H"  "A7H" "Motility Inhibitors"                                                                          
"A7X"  "A7X" "All Other Antidiarrhoeals"                                                                    
"A8A"  "A8A" "Antiobesity Preparations"                                                                     
"A9A"  "A9A" "Digestives"                                                                                   
"B1A"  "B1A" "Vitamin K Antagonists"                                                                        
"B1B"  "B1B" "Fractionated Heparins"                                                                        
"B1B"  "B1B" "Other Heparins"                                                                               
"B1B"  "B1B" "Unfractionated Heparins"                                                                      
"B1C"  "B1C" "ADP (Adenosine Diphosphate) Receptor Antagonist Platelet Aggregation Inhibitors"              
"B1C"  "B1C" "Cyclo-oxgenase Inhibitor Platelet Aggregation Inhibitors"                                     
"B1C"  "B1C" "GP IIb/IIIa (Glycoprotein) Antagonist Platelet Aggregation Inhibitors"                        
"B1C"  "B1C" "Other Platelet Aggregation Inhibitors"                                                        
"B1C"  "B1C" "Platelet Aggregation Inhibitors"                                                              
"B1C"  "B1C" "Platelet CAMP Enhancing Platelet Aggregation Inhibitors"                                      
"B1D"  "B1D" "Fibrinolytics"                                                                                
"B1E"  "B1E" "Direct Thrombin Inhibitors"                                                                   
"B1F"  "B1F" "Direct Factor Xa Inhibitors"                                                                  
"B1X"  "B1X" "Other Antithrombotic Agents"                                                                  
"B2A"  "B2A" "Other Antifibrinolytics"                                                                      
"B2A"  "B2A" "Synthetics Antifibrinolytics"                                                                 
"B2B"  "B2B" "Antagonists (Antidotes To Anticoagulants)"                                                    
"B2C"  "B2C" "Coagulation Inhibitors"                                                                       
"B2C"  "B2C" "Inhibitors Of Fibrinolysis"                                                                   
"B2C"  "B2C" "Inhibitors Of The Kallikrein-kinin-system"                                                    
"B2C"  "B2C" "Other Proteinase Inhibitors"                                                                  
"B2D"  "B2D" "Anti-inhibitor-coagulation Complex"                                                           
"B2D"  "B2D" "Factor VIII"                                                                                  
"B2D"  "B2D" "Factor XIII"                                                                                  
"B2D"  "B2D" "Factors II, VII, IX and X"                                                                    
"B2D"  "B2D" "Fibrinogen"                                                                                   
"B2D"  "B2D" "Other Blood Fractions"                                                                        
"B2E"  "B2E" "Thrombopoietin Agonists"                                                                      
"B2F"  "B2F" "Tissue Sealing Preparations"                                                                  
"B2G"  "B2G" "Systemic Haemostatics"                                                                        
"B3A"  "B3A" "Haematinics"                                                                                  
"B3C"  "B3C" "Erythropoietin Products"                                                                      
"B3X"  "B3X" "Other Anti-anaemic Products"                                                                  
"B6B"  "B6B" "Hyaluronidase"                                                                                
"B6C"  "B6C" "Other Haematological Agents"                                                                  
"C1A"  "C1A" "Plain Cardiac Glycosides"                                                                     
"C1B"  "C1B" "Anti-arrhythmics"                                                                             
"C1C"  "C1C" "Cardiac Dopaminergic Agents"                                                                  
"C1C"  "C1C" "Cardiac Stimulants Excluding Dopaminergic Agents"                                             
"C1D"  "C1D" "Coronary Therapy Excluding Calcium Antagonists And Nitrites"                                  
"C1E"  "C1E" "Nitrites And Nitrates"                                                                        
"C1F"  "C1F" "Positive Inotropic Agents"                                                                    
"C1X"  "C1X" "All Other Cardiac Preparations"                                                               
"C2A"  "C2A" "Antihypertensives (Of Non-herbal Origin) Plain"                                               
"C2B"  "C2B" "Antihypertensives (Of Non-herbal Origin)"                                                     
"C3A"  "C3A" "Loop Diuretics Plain"                                                                         
"C3A"  "C3A" "Other Diuretics"                                                                              
"C3A"  "C3A" "Potassium-sparing Agents Plain"                                                               
"C3A"  "C3A" "Thiazides And Analogues Plain"                                                                
"C3A"  "C3A" "Vasopressin Receptor Antagonist Diuretics"                                                    
"C4A"  "C4A" "Calcium Antagonists With Cerebral Activity"                                                   
"C4A"  "C4A" "Cerebral And Peripheral Vasotherapeutics Excluding Calcium Antagonists With Cerebral Activity"
"C5A"  "C5A" "Topical Anti-haemorrhoidals"                                                                  
"C5C"  "C5C" "Varicose Therapy"                                                                             
"C6A"  "C6A" "Other Cardiovascular Products"                                                                
"C7A"  "C7A" "Beta-blocking Agents, Plain"                                                                  
"C7B"  "C7B" "Combinations With Antihypertensives And/Or Diuretics"                                         
"C8A"  "C8A" "Calcium Antagonists"                                                                          
"C8B"  "C8B" "Calcium Antagonist/Beta-blocker Combinations"                                                 
"C9A"  "C9A" "ACE Inhibitors"                                                                               
"C9B"  "C9B" "ACE Inhibitor Combinations With All Other Drugs"                                              
"C9B"  "C9B" "ACE Inhibitor Combinations With Antihypertensives (C2) And/Or Diuretics (C3)"                 
"C9B"  "C9B" "ACE Inhibitor Combinations With Calcium Antagonists (C8)"                                     
"C9B"  "C9B" "ACE inhibitor/Beta-blocker Combinations"                                                      
"C9C"  "C9C" "Angiotensin-II Antagonists"                                                                   
"C9D"  "C9D" "Angiotensin-II Antagonist Combinations With Antihypertensives (C2) And/Or Diuretics"          
"C9D"  "C9D" "Angiotensin-II Antagonist Combinations With Beta-blockers"                                    
"C9D"  "C9D" "Angiotensin-II Antagonist Combinations With Calcium Antagonists"                              
"C9D"  "C9D" "Angiotensin-II Antagonist Combinations With Other Drugs"                                      
"C9X"  "C9X" "Other Agents Acting On The Renin-angiotensin System"                                          
"D1A"  "D1A" "Antifungals"                                                                                  
"D3A"  "D3A" "All Other Wound Healing Agents"                                                               
"D3A"  "D3A" "Skin/Dermal/Epidermal/Equivalents"                                                            
"D4A"  "D4A" "Anti-pruritics"                                                                               
"D5A"  "D5A" "Topical Antipsoriasis Products"                                                               
end
I would like to put a 0 before every number but just in the strings having three values. For instance "C9D" should become C09D, A3G A03G and so on.

Is there a way to do that? Thank you,

Federico

Count function using string

$
0
0
Dear All,

I am using firm-level data to gather information on the number of products produced within an industry. The data excerpt is as follows:
Company Name Product/Raw Material name
3 F Industries Ltd. ACID OILS
CHOCOLATE
CRUDE OILS
DEOILED CAKES
EDIBLE OILS
EXPELLER OIL CAKES
EXPELLER OILS
F C GLYCERINE
FATTY ACIDS & GLYCERINE
FLOUR MILL
MAIZE
OTHER ITEMS
PALM FFB
PALM NUTS
PITCH OILS
POWER
RAW OILS
REFINED OIL
REFINED WAX,VEGETABLE WAX
RICE
S F OLEINS
S F STEARINS
STEARIC ACID/ HARD OILS
VANASPATI
VEGETABLE OILS
3D Technopack Pvt. Ltd. SEAMLESS PLASTIC TUBES
3M India Ltd. ABRASIVE
EPOXY RESIN
INCOME FROM CONTRACT RESEARCH
INTEREST
OTHERS
OTHERS (TRADED)
PAINT POLISHES
PAPER & PAPER TAPE
SALE OF SCRAP
SELF ADHESIVE LABLES
SURGICAL & DENTAL PRODUCTS
A B B India Ltd. COMMISSION
ELECTRONIC CONTROL & SUPPLY UNITS
ERECTION & OTHER SERVICES
GAS ANALYSERS & SYSTEMS
MINI-COMPUTER/MICROPROCESSOR BASED SYSTEMS
MOTORS/ALTERNATORS/GENERATORS UPTO 20 MW
MULTIPLEXURES
OTHERS
PLCC EQUIPMENT
POWER CAPACITORS
POWER TRANSFORMERS
PROCESS CONTROL INSTRUMENTS
PROJECT ITEMS
ROBOTICS
SCRAP
SWITCHGEARS OF ALL TYPES
TELEMETERING EQUIPMENT
TURBOCHARGERS
In the above table, 3F Industries Ltd. and 3D technopack pvt. ltd. produce 25 and 1 product respectively. Is it possible to count string entries in a column based on groups?
The original bysort command, i.e., bysort companyname: egen products=count(productrawmaterialname) does not work. Is there a way where I can generate unique ids for each company and then use bysort? When I use gen id=_n, stata asks me to sort company name, which does not serve the purpose. Please help.

Merge

$
0
0
Hi all,

I have the following two datasets. The first one looks like follows:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4 atc3 float Year
"A10C" 2004
"A10C" 2005
"A10C" 2006
"A10C" 2007
"A10C" 2008
"A10C" 2009
"A10C" 2010
"A10C" 2011
"A10C" 2012
"A10C" 2013
"A10C" 2014
"A10C" 2015
"A10D" 2004
"A10D" 2005
"A10D" 2006
"A10D" 2007
"A10D" 2008
"A10D" 2014
"A10E" 2004
"A10E" 2005
"A10E" 2006
"A10E" 2007
"A10E" 2008
"A10E" 2009
"A10E" 2010
"A10E" 2011
"A10E" 2012
"A10E" 2013
"A10E" 2014
"A10E" 2015
"A10H" 2004
"A10H" 2005
"A10H" 2006
"A10H" 2007
"A10H" 2008
"A10H" 2009
"A10H" 2010
"A10H" 2011
"A10H" 2012
"A10H" 2013
"A10H" 2014
"A10H" 2015
"A10J" 2004
"A10J" 2005
"A10J" 2006
"A10J" 2007
"A10J" 2008
"A10J" 2009
"A10J" 2010
"A10J" 2011
"A10J" 2012
"A10J" 2013
"A10J" 2014
"A10J" 2015
"A10K" 2004
"A10K" 2005
"A10K" 2006
"A10K" 2007
"A10K" 2008
"A10K" 2009
"A10K" 2010
"A10K" 2011
"A10K" 2012
"A10K" 2013
"A10K" 2014
"A10K" 2015
"A10L" 2004
"A10L" 2005
"A10L" 2006
"A10L" 2007
"A10L" 2008
"A10L" 2009
"A10L" 2010
"A10L" 2011
"A10L" 2012
"A10L" 2013
"A10L" 2014
"A10L" 2015
"A10M" 2004
"A10M" 2005
"A10M" 2006
"A10M" 2007
"A10M" 2008
"A10M" 2009
"A10M" 2010
"A10M" 2011
"A10M" 2012
"A10M" 2013
"A10M" 2014
"A10M" 2015
"A10N" 2006
"A10N" 2007
"A10N" 2008
"A10N" 2009
"A10N" 2010
"A10N" 2011
"A10N" 2012
"A10N" 2013
"A10N" 2014
"A10N" 2015
end
The second one does not contain the information of the Year but just the information of the act3 name, i.e.:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4 atc3
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
"A10C"
end

I would like to merge the two on the atc3 name either not knowing if all atc3 of database 2 are present also in database 1 and being aware that in both databases atc3 variable does not uniquely identify observations. Is there a way to do it? I do not think a merge m:m should go: indeed the problem is that in the first database the atc3 repeats n times according to the Year variable (i.e. is an unbalanced panel) while in the second database it repeats m times according to other variables not present in the first database.

Thanks,

Federico

Correlation tables and R-squared in panel data

$
0
0
Dear all,

currently I'm running a panel regression as a part of a seminar. My topic is the statistical problem of multicollinearity. At the moment I'm creating a correlation matrix with the command estat vce, corr.This command does only tell me about the correlations between the independent variables. However I'm interested in the correlation of the independent variables to the dependent variable. Is there a command to perform this? Also, is there a command to get the individual R-squareds of the independent variables?

Many thanks,

Julian

Numbering Similar Observations

$
0
0
Hello,

I'm having significant difficulty numbering observations. I've attached a screenshot for clarity. In this subset of data, many of the observations underneath the serial number variable are repeated. They are different individuals living under the same household. I'd like each individual in the household to be labeled 1, 2, 3, 4, etc., resuming at 1 for each subsequent serial number. I've been trying to come up with different variations for how to do this for a few hours, only to be met with error messages. If anyone knows a command to do this, I'd greatly appreciate it as I can't go through several million observations manually entering that data.

Thank you

type mismatch in a regression with &

$
0
0
Hello,

When I run this regression :
xi: areg z_educ i.stateid hhsize highest_maleeduc highest_femeduc men_age women_age hh_total_income if hindu ==1 & urban == 0 & hhsize <=15 & hh_total_income >1000 & hh_total_income < 160000 & landowner == 1 [pweight = weight], absorb(districtid) cluster (districtid)

I get type mismatch r(109). Variables after "if are numerical
i think the problem comes from & since when I run :
xi: areg z_educ i.stateid hhsize highest_maleeduc highest_femeduc men_age women_age hh_total_income if hindu ==1,
it works !

Thanks for your answer

import tfw or tif data on STATA

$
0
0
Hello,
I am very new at geographic data analysis. I have the project to use tfw or tif datasets (NOAA nightlight data) and merge them with csv data (geocoded), and then study those datasets on STATA. Can someone help me with that please ?
Best
ML

Margins and marginsplot command to estimate predicted values (adjusted predictions) with multiple categorical variables

$
0
0
Dear Stata users,

I am using the margins and marginsplot commands to generate wage-experience (graphical) profiles.
Let's keep matters simple and say when I
Code:
regress logwage c.experience##c.experience
, that is logwage on experience and experience^2, and I want predicted logwage on the vertical axis and experience on the horizontal axis, I do the following:
Code:
margins, at(experience=(1(1)40))
marginsplot
Let us now say I want to model experience as fourty categorical variables and then get the predicted logwage values on the vertical axis and experience on the horizontal axis ranging from 1-40:
Code:
regress logwage ib0.experience
.

I am not sure how to program this with the margins and marginsplot command.

I would highly appreciate some help.

Have all a great holiday season and good start into the Year 2020.

Can i have stationary and non-stationary variables together in a panel data model?

$
0
0
I run a panel data model (N=5, T=17, unbalance). The depended variable is stationary while three of the six independent variables are non-stationary. These non-stationary variables are cointegrated. Are the regression results misleading?

Are there any assumptions for npregress?

$
0
0
Hi,

I am working on an abstract. I want to build model for continuous outcome variable (not normally distributed), with categorical predictor and several covariates (continues and categorical). Since the residual not pass the normality assumption, I would like to try npregress.

However, I did not find any source of the assumption checking and evaluating goodness of fit information for npregress. How can I know how well is npregress fits the observation, only using R^2?

Hope someone could get suggestions.



Thanks,
Jessica

Interpretation of output

$
0
0
Dear all,

I just started using STATA hence I need help in interpreting an output.
Is the P-value in red considered p-value for trend in this case?


Source SS df MS Number of obs = 313
F(2, 310) = 6.88
Model 42.0006944 2 21.0003472 Prob > F = 0.0012
Residual 946.335311 310 3.05269455 R-squared = 0.0425
Adj R-squared = 0.0363
Total 988.336005 312 3.16774361 Root MSE = 1.7472


SE_RE Coef. Std. Err. t P>t [95% Conf. Interval]

myopicparentnumber
One parent -.4551801 .2339904 -1.95 0.053 -.9155903 .0052301
Two parents -.968244 .2610374 -3.71 0.000 -1.481873 -.4546149

_cons .1764583 .1783225 0.99 0.323 -.1744171 .5273338

Fixed effects models with instrumental variables and bootstrapped standard errors within clusters

$
0
0
I'm trying to run some panel data, and the way the sampling occurred I should bootstrap the standard errors with resampling by cluster (as described in Harden 2011). I've done this successfully with xtreg (fixed effects) but I'm trying to incorporate instrumental variables and I'm getting some error messages.

The data I have is protected, but I can simulate the problem with the nlswork dataset.

Code:
cls  
webuse nlswork, clear  

keep if year==77 | year==78  

gen sampleclustervar=1 if idcode<2696
replace sampleclustervar=2 if idcode>2696 & idcode<6000  

xtset id year xtreg ln_wage age tenure hours union, fe vce(bootstrap, reps(1000))  cluster(sampleclustervar) // This line works fine
xtivreg ln_wage age tenure hours (union= south), fe vce(bootstrap, reps(1000))  cluster(sampleclustervar) // This line does not work

According to what I'm seeing in the help file, this should work, I think. But instead I get:

Code:
option cluster() not allowed
an error occurred when bootstrap executed xtivreg
And unfortunately it doesn't look like xtivreg2 supports it either, which is too bad because I really like the automatic tests that come with it. Does anyone have an idea of how to fix this? I'm using 15.1



(Note: I apologize for posting this twice. I didn't post the right tags on this earlier and now I can't seem to delete my original or edit it to put the tags on. The original was here: https://www.statalist.org/forums/for...ors-by-cluster)

Better looking window (resolution)

$
0
0
Dear all,

I was wondering if there is a way to increase the resolution of the whole Stata screen, i.e. make the words look better. To be more precise: I noticed that Stata 15 looks much better in terms of resolution (again, not for graphs but only in terms of general Stata window, like font resolution) than Stata 13. I have noticed this after using both versions in two screens which have the same resolution.

I hope somebody can help me.

Best regards

Xtlogit correctly predicted

$
0
0
Dear stat users,

I am interested in calculating the correctly called event, false alrams, specifity, sensitivity,etc for the fixxed effect logit.
I want to calculate something like below.

probit event var1 var2 var3 var4, nolog

estat classification, cutoff(.1)

Array


Is there anyway to get this Statistics for the fixed effect logit or should I do it manually?






Structural equation model (SEM): degree of freedom and bootstrapping

$
0
0
Dear Statalist,

First of all, Happy holidays to the people on this forum!
I have 2 questions concerning structural equation modelling (SEM) using Stata SE 14 on Mac OS 10.13.

The first question is basically "how do I calculate the degree of freedom (DoF) for an SEM model". I am aware that the definition of DoF is:
number of information ( k(k+1/2) where k is the number of variables ) minus number of parameters one wishes to estimate.

However, this formula does not seem to work for my case, where I aim to run a very simple mediation model to test if loneliness mediates the association between stigma and depression in my sample (n=350) using the command:
Code:
sem (lonely -> depress, ) (stigma -> depress, ) (stigma -> lonely, ),  nocapslatent
There are three variables here (k=3) so the number of information should be 6 (3(3+1)/2). I am only estimating 5 parameters (3 pathways shown in the sem code and 2 error variances). This should give a DoF of 1. I am confused why the results show that there is a 0 degree of freedom?

The second question concerns Bootstrap failures. Here I used another data (n=120, no missing value) to test the same mediation effect mentioned above, but as can be seen in my codes below, a measurement component is included so that there are 3 indicators for stigma, which is now represented by a latent variable. I have also adjusted for employment and education level.

Code:
. sem (latentstigma -> gih_m, ) (latentstigma -> lih_r, ) (latentstigma -> lih_atol, ) (latentstigma loneliness employment education -> depression, ) (latentstigma employment education -> loneliness, ), latent(latentih ) nocapslatent vce(bootstrap, reps(10) seed(1234))
(running sem on estimation sample)

Bootstrap replications (10)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
.x.x..xx..

Structural equation model                       Number of obs     =        120
Log likelihood = -1926.6482                     Replications      =          6
The results showed a high number of bootstrap failures (4 out of 10). It also took unusually long to run compared to my other, more complex, sem models (approx. 30 minutes for just 10 reps)
There has been previous report of bootstrap failure on this forum where the -noisily option is suggested to diagnose the bootstrap execution. I have done so with the following codes:

Code:
program bootsem1, rclass
     sem (latentstigma -> gih_m, ) (latentstigma -> lih_r, ) (latentstigma -> lih_atol, ) (latentstigma loneliness employment education -> depression, ) (latentstigma employment education-> loneliness, ), latent(latentstigma ) nocapslatent
     estat teffects, compact
     mat ind = r(indirect)
     mat dir = r(direct)
     mat tot = r(total)
     return scalar ind = ind[1,2] 
     return scalar dirih = dir[1,2]
     return scalar dirlonely = dir[1,1]
     return scalar tot = tot[1,2]
end

set seed 1234
bootstrap r(ind) r(dirih) r(dirlonely) r(tot), noisily reps(10) : bootsem1
The results suggested the failed bootstraps ran more than 15,000 iterations and yielded the error message:
Code:
Convergence not achieved
an error occurred when bootstrap executed bootsem1, posting missing values
These bootstraps are also the main reason it took so long.
As mentioned, this dataset has no missing value, I am therefore not sure how this came to be and would very much like to know what you think may have gone wrong.
I hope the above question has been presented clearly and following the correct formats.
Please kindly let me know if I can provide any additional information.
Any and all help is very deeply appreciated. Thank you in advance.

Kai-Yuan

*PPMLHDFE number of observations

$
0
0
Hi,

I am running a trade gravity model.

When I run the model with OLS, the number of observations is the same even if I run the model without or with exporter-time and importer-time fixed effects.

However, when I run the model with PPMLHDFE the number of observations is higher when I run the model without the fixed effects than when I run the model with the fixed effects.

Which do you think could be the reason?

Thanks!



Increasing memory, exact logistic regression

$
0
0
Hi,

I'm using STATA 16. I'm trying to do an exact logistic regression, but it gives me the error message "exceeded memory limit of 10.0M bytes; use the memory() option to increase the
memory limit"

However, I've read the instructions and I don't get it... say I want to increase the memory to for example 30 megabyte, what exactly would I type into the command box?

I'm grateful for any help.

Merry Christmas!

How to get the SEM path figure after running -sem- command

$
0
0
I know we could use SEM builder to draw the sem path figure first and then get the estimations and code. I am wondering whether we can do this reversely - we code the sem part by ourselves, and then get the sem figure automatically.

For example, after the following commands, is there a way to get the SEM path figure?
Code:
sysuse auto.dta
sem(price <- mpg headroom)(mpg <- headroom)

Q about Difference-In-Difference model with unbalanced panel data

$
0
0
Hi all,
I am currently thinking to use difference-in-difference model in my project but not sure whether this is a feasible way I can pursue for my dataset. My project tries to explore the effect of identity shift for an emerging mobile App on its user base growth. My dataset is restricted between 2014 and 2018. Since my focus is on emerging mobile Apps, my dataset will include all new apps launched during this period and trace their monthly user base change. As those Apps launched in different months and the treatment timing (identity shift chosen by an App owner) happened in multiple time, my panel dataset is unbalanced for both control group and treatment group in the sense that I don't have equal number of observation for different entities (Apps). Is this a serious issue when I try to use DID model in this case?
Thanks for taking time to read my question!
Best wishes,
Eric

How to make a random sample or subset of data with two group?

$
0
0
I am new user of stata, kindly forgiven my ignorance and poor English.
My case is here. I have a data set consist 800+ company with other variable, such as total asset, total debt and many other from year 2010 to year 2016.
I have divide this 800+ company in to two group with a dummy variable (company do not being targeted for takeover during the study period (2010-2016)= 0, otherwise= 1).
However, I find out number of company is been targeted is only 50+ and the other side is about 700+.
So, I wish create a subset of data from this 700+ company(dummy=0) to compare with the 50+ company(dummy=1).
if it is possible included Total asset as one of the factor, such as new group 0 (dummy=0) having the same mean with group 1.
or just a random sample from group 0 with same number of company in group 1.
Thank you!
Viewing all 72821 articles
Browse latest View live


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