background preloader

Stata

Facebook Twitter

Best practices - How to efficiently manage a statistical analysis project? Annotated Stata Output: ttest. Stata Annotated Output T-test The ttest command performs t-tests for one sample, two samples and paired observations. The single-sample t-test compares the mean of the sample to a given number (which you supply). The independent samples t-test compares the difference in the means from the two groups to a given value (usually 0). In other words, it tests whether the difference in the means is 0. The dependent-sample or paired t-test compares the difference in the means from the two variables measured on the same set of subjects to a given number (usually 0), while taking into account the fact that the scores are not independent.

In our examples, we will use the hsb2 data set. use clear (highschool and beyond (200 cases)) Single sample t-test The single sample t-test tests the null hypothesis that the population mean is equal to the given number specified using the option write == . Ttest write==50 Summary Statistics c. D. E. Test Statistics i. Regression with Stata Web Book: Chapter 2 - Regression Diagnostics. Stata Web Books Regression with Stata Chapter 2 - Regression Diagnostics Chapter Outline 2.0 Regression Diagnostics 2.1 Unusual and Influential data 2.2 Checking Normality of Residuals 2.3 Checking Homoscedasticity 2.4 Checking for Multicollinearity 2.5 Checking Linearity 2.6 Model Specification 2.7 Issues of Independence 2.8 Summary 2.9 Self assessment 2.10 For more information 2.0 Regression Diagnostics In the previous chapter, we learned how to do ordinary linear regression with Stata, concluding with methods for examining the distribution of our variables.

Without verifying that your data have met the assumptions underlying OLS regression, your results may be misleading. Additionally, there are issues that can arise during the analysis that, while strictly speaking are not assumptions of regression, are none the less, of great concern to data analysts. Many graphical methods and numerical tests have been developed over the years for regression diagnostics. Predict r, rstudent avplots 1. Some notes on text editors for Stata users. (last updated: 5 July 2006) Comments and corrections to Nicholas J. Cox, Durham University Contributions by and acknowledgements to Email addresses are given in the form joanna.smith at whereever.whatever and so should be translated to joanna.smith@whereever.whatever.

This FAQ is intended primarily for users of the statistical software Stata. Frequently there are questions on Statalist seeking advice on text editors to use with Stata. If this web page is of any interest to people who are not Stata users, that's fine. Limitations – and a disclaimer Just a brief search of the internet or of available documentation will reveal many possible editors, even for one of the platforms, Macintosh, various flavors of Unix (including Linux) and Windows, on which Stata runs.

Don't use a word processor to edit text files First, be clear about the difference between a word processor and a text editor. Word processors insert line breaks and page breaks to make the document follow a uniform style. Resource links. Resources to help you learn and use Stata. Introduction to Stata. This tutorial is an introduction to Stata emphasizing data management and graphics. A complementary discussion of statistical models may be found in the Stata Logs section of my GLM course at 1. Introduction Stata is a powerful statistical package with smart data-management facilities, a wide array of up-to-date statistical techniques, and an excellent system for producing publication-quality graphs.

The tutorial has been updated for version 13, but most of the discussion applies to versions 8 and later. 1.1 A Quick Tour of Stata Stata is available for Windows, Unix, and Mac computers. Local Note: At OPR you can access Stata/SE on Windows by running the network version on your own workstation, just create a shortcut to \\opr\shares\applications\stata13-se\stataSE.exe. 1.1.1 The Stata Interface When Stata starts up you see five docked windows, initially arranged as shown below: The window labeled Command is where you type your commands. #delimit cr. Re: st: do-file editor shortcuts. Regression with Stata Web Book: Chapter 2 - Regression Diagnostics. Dummy variables | The Stata Things. There are two straightforward ways to turn string variables into corresponding dummies -- also known as categorical variables -- using Stata.

One is an extension of the tab command: tab stringvar, gen(dummy) Another makes use of the fact that you seldom need dummies for their own sake. Usually you want them used in some sort of regression model. The xi: extension to various estimation commands turns string variables into dummies automatically, as in xi: regress y x i.stringvar Both are described in detail here and they both work well when your string variable translates into dummies directly.

That, however, is not always the case. Think of a data set where you have a string variable named "color" which is equal to "red" for the first observation, "blue" for the second and "yellow, blue" for the third. I just ran across such a data set today. That's it. This may look like a lot of work, and it is, but it's all up-front. Stata // - SymbolHound Search. u17.pdf. u18.pdf. Matrix Operations in Stata. Multivariate Analysis Matrix Operations in Stata The Matrix matrix A = (2,1\3,2\-2,2) matrix list A A[3,2] c1 c2 r1 2 1 r2 3 2 r3 -2 2 Multiplication by a Scalar mat B = 3*A mat lis B B[3,2] c1 c2 r1 6 3 r2 9 6 r3 -6 6 Matrix Addition & Subtraction mat B = (1,1\4,2\-2,1) mat C = A + B mat lis C C[3,2] c1 c2 r1 3 2 r2 7 4 r3 -4 3 mat D = A - B mat lis D D[3,2] c1 c2 r1 1 0 r2 -1 0 r3 0 1 Matrix Multiplication mat D = (2,1,3\-2,2,1) mat C = D*A mat lis C C[2,2] c1 c2 r1 1 10 r2 0 4 mat C = A*D mat lis C C[3,3] c1 c2 c3 r1 2 4 7 r2 2 7 11 r3 -8 2 -4 mat D = (2,1,3) mat C = D*A mat lis C C[1,2] c1 c2 r1 1 10 mat C = A*D conformability error r(503); Transpose of a Matrix mat AT = A' mat lis AT AT[2,3] r1 r2 r3 c1 2 3 -2 c2 1 2 2 mat ATT = AT' mat lis ATT ATT[3,2] c1 c2 r1 2 1 r2 3 2 r3 -2 2 Common Vectors Unit Vector mat U = J(3,1,1) mat lis U U[3,1] c1 r1 1 r2 1 r3 1 Common Matrices Unit Matrix mat U = J(3,2,1) mat lis U U[3,2] c1 c2 r1 1 1 r2 1 1 r3 1 1 Diagonal Matrix Identity Matrix Symmetric Matrix.