Creating table where avg return for each portfolio in each year is given
Dear stata users, I am quite new in Stata and struggeling with some codes. I want to find out if there is a correlation between the goodwill within a company and its returns. I calculated the monthly...
View ArticleReferencing outside data set to generate new variables
I've generated a data set (call this percentile.dta) that connect test scores to percentiles depending on the year and test type. I'm left with 5 variables: score, test1_percentile, test2_percentile,...
View ArticleCan stata do reduced rank regression analysis?
Hello everybody, Has someone any experiences doing reduced rank regressions with stata? A colleague of mine will have to use this as a main analysis type and so far only found solutions for SAS. Thank...
View ArticleHelp on creating a new variable
'Create a variable which gives you the change in price from the 1st to 2nd period of a combination' can anyone help? message me if you would like more background would really appreciate it
View ArticlePanel structure with repeated time values: problem with xtset
Dear All, I am working with a dataset of tweets by politicians. For each tweet, some dummy variables - such as "inequality" and "migration" in the example below - are equal to 1 if that particular...
View ArticleHandling time and date
Dear all, I'm very new to Stata, I'm more used to SPSS. I need to define missing values for time variable, but no matter what I try it doesn't work, and I can't seem to find answers in any material....
View ArticleAccess 95%CI after using svy: mean variables, over(group)
Hi, I'm working with a dataset that uses some fancy survey sampling design, which I think I've finally understood. After using the svy-commands, and so on, I want to find the means and 95% CI of the...
View ArticleReshaping cross sections to panel data
Dear Ms./Mr., I need your help urgently in converting the following data set from 1980-1999, X_Country1 Y_Country1 X_Country2 Y_Country2 X_Country3 Y_Country3 and I am asked to pool it and run...
View ArticleTweaking 1st stage of 3SLS
I am trying to estimate following two simultaneous equations using 3SLS: y1 = x1 x2 y2 = y1 y1*x1 x1 x3 (where y1*x1 is an interaction term; it is the variable of interest) My problem is 1st stage...
View Articleprogram end leads to stata breaking?
Hi Statalist, I am having difficulty fixing this particular (probably syntactic?) error and would appreciate another pair of eyes looking at it. I want to define a program inside a forvalues loop. I've...
View ArticleIs margins the correct approach?
Hi all, A colleague and I are attempting to determine whether an analysis we'd like to accomplish is done so using the margins command. They write: "Back in my graduate school days, I *think* I...
View ArticleHow to check if I have duplicates without perfectly duplicated obs
Dear All, I am a long data, with duplicated IDs, as there are obs for different dates. I would like to check if there are difference between the variables for each ID and Date (as my title say:...
View ArticleAdding a plot of means to a twoway graph.
Dear All, I want to plot a twoway graph that includes both, linear fit with confidence intervals and the annual means (connected with a line). My data is an annual panel: Code: * Example generated by...
View Articlemargins command
hi, Probit model as school enroll is a binary variable. Height for age is a continuous var. schoolenroll=male+heightforagezscore+(heightforage *male) i want the effect of height of girls vs boys on the...
View ArticleShading Graphs - Area Plot Tapered
Hello, I am trying to plot a trend line with recessionary periods shaded in grey. Prior posts on this forum address the methods of shading graphs (e.g.,...
View ArticleFuzzy merge between two datasets, using jarowinkler distance
Hi, I have one dataset that contains information about the full name (two names, two surnames) of 200.000 persons, approximately. This (string) information is not of high quality, in the sense that...
View ArticleSpecification curve
FYI: Hans Sievertsen has released on demo program to create a specification curve on GitHub. In the example below, the graph displays 72 robustness checks. https://github.com/hhsievertsen/speccurve...
View ArticleEstimate of mean squared error
Hello, Is there a Stata written command that allows one to determine the mean squared error from a mixed-effects linear regression model? I want to estimate this quantity for a simulation analysis that...
View ArticleBatistical Analysis
Happy Halloween Code: cap preserve drop _all set seed 7 set obs 15 g y=uniform() g x=uniform() g m="🦇" tw sc y x, graphr(c(purple)) plotr(c(black)) msy(i) mla(m) mlabp(0) mlabs(*15) ysc(r(-.2 1.2))...
View ArticleWeighting by how often something shows up
I am trying to weight areas of a twoway scatter by how frequent they show up. For instance scatter var1 var2 Say I have many observations that show up at the point (1,1) on my scatter plot, but not...
View Article