Week 1: Exploratory Data Analysis & Basic Statistics Flashcards
What is the purpose of logs?
Logs record commands and output, allowing a permanent record of a session. Start a log with <log>, pause with <log>, resume with <log> and close with <log></log></log></log></log>
How can you view data?
Use <browse> to open a data table showing variables as columns and observations as rows.</browse>
How do you explore variable labels and codes?
Use <codebook> to view the labels and codes for a variable.</codebook>
What command is used to replace missing values?
Use <replace varname =. if varname == code> or <recode varname (code1/code2 =.)> to assign missing values.
What are the basic commands for viewing summary statistics?
Use <summarize> for basic stats, and <summarize varname, detail> for additional stats like median, mode, and percentiles.</summarize>
How do you create frequency tables?
Use <tab> to create a single frequency table for categorical data.</tab>
Which command generates a histogram?
Use <histogram varname, frequency> to produce a histogram showing the frequency distribution.
What syntax allows side-by-side histograms by category?
<histogram varname, frequency by(category)> creates histograms by groups (e.g., gender)
How can bar charts be generated?
For a basic bar chart, use <graph bar, over(varname)>, and adjust options for clarity.
Note: If you want frequencies instead of percentages, use the following command <graph bar(count), over(varname)>
Describe clustered bar charts in Stata.
Clustered bar charts display data for two variables. Use <graph bar, over(var1) over(var2)> to separate bars for each category of both variables.
What are box plots used for in Stata?
Box plots show data dispersion using the median, quartiles, and outliers. Use <graph> to create a box plot.</graph>
What is a cross-tabulation in Stata, and how is it done?
Cross-tabulation compares the frequency distribution of two variables. Use <tab var1 var2, row> or <tab var1 var2, col> for row/column percentages.
How do you save logs?
Save logs as PDFs using <translate></translate>