WITH 100% CORRECT ANSWERS
\.Assign label
To assign a label that you have created to a variable type: - ANSWERS-Assign label
To assign a label that you have created to a variable type:
label values variablename labelname
See Lecture 2 slide 11, for an example.
\.Bar chart
Plot for one categorical variable: - ANSWERS-graph bar (count),
over(variablename) bar chart with frequencies on the y-axis
graph bar (percent), over(variablename) bar chart with percentages on the y-axis
\.Boxplot - ANSWERS-graph hbox variablename
graph vbox variablename
Creates a boxplot for a single numerical variable. Example: Lecture 4 slide 9
For boxplots by group see "Comparative boxplot"
\.Chi-squared goodness of fit test
Analysing one categorical variable. - ANSWERS-Chi-squared goodness of fit test
, Analysing one categorical variable.
To find the p-value having calculated the chi-squared test statistic type:
display chi2tail(df, test_statistic)
See Lecture 5, slide 38.
To analyse a column of categorical data with hypothesised frequencies you either
need to do the hand calculations yourself and then find the p-value as above or, to
analyse the column of data, install the csgof package using:
findit csgof
then type:
csgof categorical_variablename, expperc(perc1, perc2,...)
replacing perc1, perc2 etc with the expected (hypothesised) percentage in each
category. See example: Lecture 5 slide 41.
\.Clustered bar chart: Plot for two categorical variables: - ANSWERS-Clustered bar
chart
Plot for two categorical variables:
graph bar (count), over(variable1) over(variable2) clustered bar chart with
frequencies on the y-axis
graph bar (percent), over(variable1) over(variable2) clustered bar chart with
percentages on the y-axis
\.Comparative boxplot - ANSWERS-Comparative boxplot
graph box variablename, over(categorical_variable_name)