[R] Extract Stata estimates to use in R

Rob Denniker bearmarketsrule at inbox.com
Sat May 9 05:38:40 CEST 2009


Might as well answer myself in case anyone has this problem again...

To save a variance-covariance matrix from Stata as a CSV file that can be read into R, it's something like:

regress mpg weight foreign
matrix V=e(V)
svmat V,names(vvector)
outsheet vvector* using vv1.csv, replace


> -----Original Message-----
> From: bearmarketsrule at inbox.com
> Sent: Fri, 8 May 2009 19:09:29 -0800
> To: bearmarketsrule at inbox.com, r-help at r-project.org
> Subject: Extract Stata estimates to use in R
> 
> Before you flame me, the reason I am using Stata is that I didn't get a
> response to my query below, so I have my cluster robust covariance matrix
> in Stata [one line of code], but now I need to take all those parameter
> estimates and put them back in R so I can simulate properly.
> 
> Anyone done this before?
> 
> The Stata documentation is too esoteric for me...
> 
> http://www.stata.com/help.cgi?ereturn
> Save coefficient vector and variance-covariance matrix:
> ereturn post [b [V [C]]] [, depname(string) obs(#) dof(#)
> esample(varname) properties(string) ]
> 
> Brr??
> 
>> -----Original Message-----
>> From: bearmarketsrule at inbox.com
>> Sent: Fri, 8 May 2009 09:48:19 -0800
>> To: r-help at r-project.org
>> Subject: Probit cluster-robust standard errors
>> 
>> If I wanted to fit a logit model and account for clustering of
>> observations, I would do something like:
>> 
>> library(Design)
>> f <- lrm(Y1 ~ X1 + X2, x=TRUE, y=TRUE, data=d)
>> g <- robcov(f, d$st.year)
>> 
>> What would I do if I wanted to do the same thing with a probit model?
>> ?robcov says the input model must come from the Design package, but the
>> Design package appears not to do probit?
>> 
>> Thanks very much!
>> 
>> ____________________________________________________________
>> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on
>> your desktop!
>> Check it out at http://www.inbox.com/marineaquarium
> 
> ____________________________________________________________
> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on
> your desktop!
> Check it out at http://www.inbox.com/marineaquarium




More information about the R-help mailing list