Stata: Trying to merge two data sets with common year observations

I am currently trying to merge two datasets with a common "year" variable using Stata. One dataset is purely for incorporating CPI with an associated year, and so the only variables are "year" and "cpilevel". The other is our main dataset, and we are trying to merge the CPI-year dataset in order to create a new "cpilevel" variable in the main dataset associated with the same years. I am attaching photos of the CPI-specific dataset and a cross-section of the …
Topic: stata data
Category: Data Science

How do I pair up responses based on characteristics?

I am creating a model wherein the respondents answer questions and then I pair male and female respondents on the basis of similarity of responses. I was thinking propensity score matching through the MatchIt package in R might be a good way to proceed with something like this, however, I do not wish to calculate any treatment effects, I simply want to pair up respondents. I need guidance on how to approach this problem.
Topic: stata r
Category: Data Science

Urgent help on STATA! Panel regression, regressing lagged version of variable with itself in particular industry across few industries!

Just some kind help on the syntax for the above... Basically this is an event analysis whereby there are 10 sectors, and for instance quarterly data, so therefore, mergers that took place in a particular sector in Q3, is associated with mergers that took place in the similar sector in Q2. The panel regression is for the described scenario but for 10 industries. There are some quarters whereby there are 0 mergers in the particular industry. Thus far, have organised …
Category: Data Science

How to encode ordinal data before applying linear regression in STATA?

I have a data set that has student performance marks (continuous and dependent variable), Teacher Qualification (Ordinal and independent variable containing categories: Masters, Bachelors, High School). I want to apply the regression analysis to check the impact of teacher qualification on student's marks. How can I encode ordinal data before applying linear regression?
Category: Data Science

Stata-style replace in Python

In Stata, I can perform a conditional replace using the following code: replace target_var = new_value if condition_var1 == x & condition_var2 == y What's the most pythonic way to reproduce the above on a pandas dataframe? Bonus points if I can throw the new values, and conditions into a dictionary to loop over. To add a bit more context, I'm trying to clean some geographic data, so I'll have a lot of lines like replace county_name = new_name_1 if …
Category: Data Science

Data visualization of frequencies of state transitions (possibly in R?)

I am working on some experimental data, which can be of types A, B and C. Now I observe this data for 5 time points, and I can see them move between A to B, B to C,... etc. I see such transitions for a number of independent data points, and I have the cumulative frequencies from all data. For example, I have: $$ Period A B C \newline 1 4 4 2 2 1 2 7 3 0 1 …
Category: Data Science

Conditional logit in Stata

Question: Can Stata present or output the actual betas/coefficients in a datasheet when it performs the conditional logit model? I understand that Stata has a "predict" capability, but I need to store the betas/coefficients and use them later, after new factor values have been calculated.
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.