200 likes | 385 Views
NYU DataServices. I ntroduction to STATA. Outline. Overview of STATA Interface Getting Started Managing Data Descriptive Statistics Basic Analysis Additional Resources. NYU DataServices. Overview of STATA.
E N D
NYUDataServices Introduction to STATA
Outline • Overview of STATA • Interface • Getting Started • Managing Data • Descriptive Statistics • Basic Analysis • Additional Resources NYUDataServices
Overview of STATA • STATA is a statistical package that allows advanced data analysis, management, and graphics. • You can choose a perpetual license or an annual one. • Available for Windows and Mac. • NYUDataServices
STATA INTERFACE • Command window: NYUDataServices
STATA INTERFACE • Data window activated usingbrcommand NYUDataServices
STATA INTERFACE • Do File syntax equivalent in SPSS and R • Commands should be written and saved in Do files rather then entered directly into the command window • Some advantages to using Do files: • allows reusing commands (the same analysis can be quickly repeated on different data sets as long as the variables name match) • allows to copy, past and edit commands • easier to read complex expressions • allows sharing commands / methods with other researchers NYUDataServices
Getting Started • Working Directories • To CHECK the current directory: • pwd • To CHANGE the directory: • cd • To VIEW files in the directory: • dir NYUDataServices
Opening Datasets in STATA Creating / Opening datasets: • To create a new dataset: clear input var1 var2 var3 01 02 03 04 05 06 07 08 09 10 11 12 end NYUDataServices
Datasets in STATA • To read a Stata dataset: use dataset name • To read non-stata formats: .csv: insheet using “datasetname.csv” .dat : infile & infix • To read a non-Stata format where first row is the variables’ name: import excel ”datasetname.xls", sheet(”sheet 1") firstrow clear • To save a Stata dataset: save dataset name, replace outsheet using dataname.csv, comma replace NYUDataServices
Managing Data Creating and managing new variables • To create a new variable egen variable name • To delete one drop variable name • To recode a variable recode replace NYUDataServices
Descriptive Statistics • For a summary: sum variable name sum variable name, detail • For a cross tabulation tabulate var1 var2, chi2 • For frequencies tabulate oneway variable name NYUDataServices
Graphs • Histogram: histogram Scatter Plot dotplot • Box Plot graph box NYUDataServices
Basic Analysis • Some examples: pwcorr // pairwise correlation coefficients ttest // Mean Comparison Test regress // OLS regression anova // Analysis of Variancelogit // Logistic Regression ologit // Ordererd Logistic Regression sem // Build a Structural Equation Model NYUDataServices
The winner of all commands help NYUDataServices
Additional Resources • http://nyu.libguides.com/content.php?pid=38898&sid=1554472 • http://www.ats.ucla.edu/stat/stata/ NYUDataServices
Tutorial Evaluation • Please follow the link below: • This will only take a few minutes and help us a great lot in improving the tutorial • http://bit.ly/Stata1 NYUDataServices