-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporates option to import Stata estimation results into R. #20
base: master
Are you sure you want to change the base?
Conversation
Hi Friend, |
Could you post the code you're trying to run and whatever outcome you get? Thanks. |
Sure. Code: Outcome: Variable | Obs Mean Std. Dev. Min Max |
So it looks like it's having trouble with the import back into R. Can you confirm that you can bring the data back to R (data.out=T by itself) and what version of Stata you have? |
data.out=T is working. |
That's likely the issue. This was written in Stata 15 and they changed the syntax for the key function (putexcel) around Stata 14.2. I'll work on a solution to accommodate earlier Stata versions, but don't really have a work around for you right now. |
I tried on stata 15, but there was another error: Code: Result: Calculating NLS estimates ... Regression FGNLS
---------------- + --------------------------------- ---------------------
------------- + ------------------------------------ ---------------------------- Error in |
OK, I've pushed an update to accommodate the nslur output. |
There is still no update if I try to install from your git. |
Apologies. Still getting the hang of using github, but I think it's pushed now. Give it a try and please let me know how it turns out. |
Hi Friend. It's working now. Thanks! |
So the structure of the list will vary depending on what returns and ereturns the Stata call produces (so a lot of what is available depends on the whims of whomever is writing the Stata code). However, for most (all?) estimation commands, the output that is produced on the screen in Stata is stored in a return matrix. So, for the nlsur command you mentioned above, results <- RStata :: stata ("nlsur (d = {c1} + {c2} * e) variable (d e)", data.in = iris, returns.out = T) the screen output table is going to be in results$Active$r$matrix$table and you can extract the pvalues from there. |
Allows users to run analyses in Stata and directly import the results for further processing, reporting, or plotting in R. The addition adds the relevant option, returns.out, to the stata() function. If selected, Stata code is appended to the SRC object which loops through the active and stored return and ereturn results in Stata and writes them to an excel file. Then the excel file is read into a list in R and returned as the output.
If both data.out and returns.out are selected, a list is returned in which the first element is the data frame from the data.out option and the second element is the returns list.
On a side note, this is my first time using Github to contribute to a project, so please forgive any breaches of etiquette.