Quantcast
Channel: The Stata Blog - Latest Comments
Viewing all 1129 articles
Browse latest View live

Re: Web scraping NFL data into Stata

$
0
0

Reynaldo, it looks like the NFL data is going to be a pay API from now on and this command no longer works.


Re: Creating Excel tables with putexcel part 3: Writing custom reports for arbitrary variables

Re: Creating Excel tables with putexcel part 3: Writing custom reports for arbitrary variables

Re: Creating Excel tables with putexcel part 3: Writing custom reports for arbitrary variables

Re: Monte Carlo simulations using Stata

$
0
0

I am analyzing panel dynamic model using xtabond2. my data run for 40 years (1980-2018, but grouped into five year intervals to reduce serial correlation. i know how to invoke the bootstrap option but don't how to use Monte Carlo simulation approach. Any help would be greatly appreciated.

Re: Export tabulation results to Excel—Update

Re: Stata support for Apple Silicon

$
0
0

Had missed this post but good to see. With Apple all but eliminating the divide between Mac OS X and iOS, do you plan to enable Stata to work on higher-end iPads?

Re: Import COVID-19 data from Johns Hopkins University

$
0
0

Hi, is it possible to import to Stata from a private repo?


Re: Import COVID-19 data from Johns Hopkins University

$
0
0

There is currently no way for Stata to -webuse- a GitHub repo that is
flagged private, due to the authentication needed to access the
files. A potential workaround would be to create a personal access
token for your GitHub account at https://github.com/settings...
and string together some shell commands utilizing curl or wget.

Re: Import COVID-19 data from Johns Hopkins University

$
0
0

Thanks. Does this mean going through Terminal? Because I understand the token changes from session to session/time to time.

Re: Import COVID-19 data from Johns Hopkins University

$
0
0

Yes, you need to write the call to the GitHub repository so it can be called from the Terminal interface and/or using the -shell- command in Stata.

Re: Stata/Python integration part 1: Setting up Stata to use Python

$
0
0

Thank you Chuck for this post. I was trying to install the geopandas package using the stata environment. I was not able to install it and I was evening thinking to switch to R. This post encouraged me to further explore. Unfortunately, I am not able to install it. It shows the following error. Any help please?
errors:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/geopandas/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/geopandas/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/geopandas/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/geopandas

Re: Export tables to Excel

$
0
0

Hi Kevin,

I am using putexcel to tabulate a number of variables on a number of subsets of my data. Some of those subsets do not contain all potential values on certain variables. An easy example is a number of subsamples have males and females, while others others have only males. I am using code like that pasted below to do this within a macro across the different subsamples (districts), but the missing cells in the matrices cause my labels to be incorrect.

I am just wondering what you think the best solution would be here, whether it is tab2xl with the 'missing' option or if my code can be modified here. Thanks for your time!


levelsof district_name, local(districts)
foreach d of local districts {

tab sex, matcell(sexcounts)
matlist sexcounts
putexcel A4 = "Sex" ///
B4 = "Female" ///
B5 = "Male"
putexcel C4 = matrix(sexcounts), hcenter nformat(number_d2)
putexcel D4 = formula(=C4/`r(N)') ///
D5 = formula(=C5/`r(N)'), nformat(percent_d2)
}

Re: Export tables to Excel

$
0
0

Just as a follow up, I believe I found a suitable fix using the user-written command 'fre' , where you can specify all values to be tabulated. I thought I would post it here in case anyone ran into a similar issue. Here it is within a loop (by district_name). There may be a more elegant solution here, but this gives me accurate counts/labels for each district, even if there are not both males and females in the subsample.


fre gender if district_name=="`d'", includelabeled include(0 1)
putexcel A4 = "Sex" ///
B4 = "Female" ///
B5 = "Male"
putexcel C4 = matrix(r(valid)), hcenter nformat(number_d2)
putexcel D4 = formula(=C4/`r(N)') ///
D5 = formula(=C5/`r(N)'), nformat(percent_d2)

Re: Export tabulation results to Excel—Update

$
0
0

Can you post the command you are using so I can see the syntax?


Re: Export tables to Excel

$
0
0

You can check r(r) after tabulate and see how many levels there are in your variable and then use if for your labels.


if (`r(r()' ==2) {
B4 = "Female" ///
B5 = "Male"
}
else {
....

B4 = "Female"
....

}

Re: A simulation-based explanation of consistency and asymptotic normality

Re: Stata/Python integration part 1: Setting up Stata to use Python

$
0
0

This is cool in concept but it seems buggy. I was able to correctly get python up and running, and I even pointed stata to the correct installation of python on my mac, but if I try to import packages like numpy or pandas, Stata immediately crashes. Not sure this can be part of my normal workflow for that reason. Any ideas what could be going on? I don't get an error message, it's as if I quit Stata suddenly.

Re: Stata/Python integration part 5: Three-dimensional surface plots of marginal predictions

$
0
0

An added comment to this figure.
If you add plt.show(), you can see the figure rendered, which you can also manipulate and rotate. This may come handy if you are a visual person, and were not sure how to set up the angles for the plot.

Re: Calculating power using Monte Carlo simulations, part 3: Linear and logistic regression

$
0
0

Wow I'm glad I found this article. you describe everything really well.

Viewing all 1129 articles
Browse latest View live