44590

Stata: combining regression results with other results

Question:

I am trying to replicate some results from a study. therefore often i need to compare my regression results with results from the study that i'm trying to replicate. I have been manually combining my esttab results with the study results in excel. this however is tedious since i'm working with lot of variables. I was wondering whether there is a way to store the study results and then calling them to go next to my regression results. I tried storing them as scalars and calling them using estout however this puts the stored scalars below the regression results. i would prefer to have them side by side as another column.

Example:

Reference study results are

var b x 2.1 z 4.2

I entered these into Stata

estadd scalar x=2.1 estadd scalar z=4.2

My regression is

eststore: reg y x z estout, stats(x,z)

but when i do this i get a table like this

var b my reg x 5.3 my reg z 2.3 scalar x 2.1 scalar z 4.2

But I would want the results like this

var b scalar b my reg x 5.3 2.1 my reg z 2.3 4.2

Answer1:

The following might help. Find comments inline.

clear set more off *----- example data ----- sysuse auto keep price weight mpg *----- what you want ----- //regress and store reg price weight mpg eststo m1 // create matrix of "scalars" matrix w = (2.1 , 2.4 , 3.2) // rename matrix columns to coincide with those of regression mat colnames w = weight mpg _cons // add estadd matrix w // print estout m1, cells("b w")

Recommend

  • IBM Bluemix registry push authentication error
  • Do I need to create folder hierarchy for nested module class in Rails
  • OpenCV contours not closing
  • error plotting function using matlab
  • How to break a string over multiple lines and preserve spaces in YAML?
  • Python: Gridsearch Without Machine Learning?
  • SQL Server: How to execute UPDATE from within recursive function?
  • python - pandas - check if date exists in dataframe
  • Why is the return value of Perl's system not what I expect?
  • Prolog: Multiplying 2 lists with 1 of them not instantiated?
  • Image scaling geometry
  • Matlab: Fundamental limitations of struct array?
  • How to check if variable is Scalar or Array before mxIsScalar was introduced?
  • Assign different values to cell arrays in MATLAB at once
  • Using a rotation matrix opencv
  • How do I get width and height of my terminal with ioctl?
  • Using multiple input pipelines in TensorFlow
  • Sending rails errors to rspec output
  • coldfusion variables into powershell
  • How to set an entity field that does not exist on the table but does exists in the raw SQL as an ali
  • Highcharts - Column chart with empty columns for date in x-axis
  • in batch how do i use taskkill properly
  • Why cout is producing no output on Code Blocks?
  • Local Development, Apache vs Developer - file permissions
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • GAE: Way to get reference to an HttpSession from its ID?
  • Ember.js model to be organised as a tree structure
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • What is the purpose of TaskExecutor in spring?
  • Groovy: Unexpected token “:”
  • Jackson Parser: ignore deserializing for type mismatch
  • Converting a WriteableBitmap image ToArray in UWP
  • Replace value with Factor in r data.table
  • OpenGL ES texture problem, 4 duplicate columns and horizontal lines (Android)
  • How to access EntityManager inside Entity class in EJB3
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Is there any way to access browser form field suggestions from JavaScript?
  • Hazelcast - OperationTimeoutException
  • How can I estimate amount of memory left with calling System.gc()?