<<

Bar for and Independent t-tests

You should already have the “Survey” excel file open and the Gender and Happy variables copied into a new sheet and sorted by Gender.

1. In a blank column, enter the title ‘happy_male’ and then copy the Happy for Males into it 2. In a column next to the happy_male column, enter the title ‘happy_female’ and then copy the Happy data for Females into it 3. Create a blank table with gender labels as rows and the following column titles: , Std. Dev, N, (SE) 4. Use the formula reference table below to fill in the blank table.

Statistic Excel Formula Mean =average(cell ) (Std. dev) =stdev.s(cell range) Count (N) =count(cell range) Standard Error (SE) =standard deviation/sqrt(N) Note: The standard error is not a built in excel formula, but is calculated from the standard deviation and count values that you generated using actual excel formulas.

Next you can use the Toolpak to conduct an Independent t-test to see if the means for happy are the same for males and females.

5. Select the Data tab and choose Data Analysis in the top right hand corner 6. Choose ‘t-test: Two-Sample Assuming Unequal ’ in the Data Analysis menu 7. In the ‘Variable 1 Range’ box enter the data in the happy_male column including the variable name 8. In the ‘Variable 2 Range’ box enter the data in the happy_female column including the variable name 9. Check the Labels box 10. In the output range, enter the cells where excel will place the output (for example, G7:J20) and click OK

The output from steps 5-10 is as follows:

t-

p-value for two sided null Excel does not calculate the standard error for the t-statistic (do not confuse this with the standard error for the means).

11. Add a row underneath the t-test output and call it ‘Standard Error’ 12. In cell next to the label, enter the following equation to calculate the SE for the t-test: =sqrt(( of happy_male/observations of happy_male)+(variance of happy_female/observations of happy_female))

Finally, we can create a bar of the means of Happy for males and females that includes standard errors.

13. Select the cells with the male and female labels and the means for those values from the table generated in step 4. 14. Choose the Insert Tab 15. Select Column, and choose the first 2-D column graph option

Excel creates a bar chart, but there are still some formatting changes to add, and we also need to add standard error bars to the graph.

Graph Formatting Instructions: 16. Right click series and choose delete 17. Go to Chart Tools and click the Layout tab 18. Select the Error Bars button and choose ‘More Error Bars Options’

19. Select the Both option for direction and the Cap option for end style 20. Under the Error Amount box, select the Custom option and click the ‘Specify Value’ button 21. In the Positive Error Value box, select BOTH male and female standard error cells that you calculated in Step 4 22. In the Negative Error Value box, select BOTH male and female standard error cells that you calculated in Step 4 23. Click OK, then close the error bars interface window 24. Under the Chart Tools > Layout Tab, choose Axis Labels 25. Choose Primary Vertical Axis and select Rotated Title 26. Rename the axis title ‘Happiness Level’ 27. Choose Axis labels and select primary horizontal axis title and select Title Below Axis 28. Rename the axis label ‘Gender’ 29. Select Chart title and choose ‘Above chart’ 30. Rename the chart title Gender differences in happiness 31. Right click one of the bars 32. Select the Shape Fill option and choose any greyscale color

The graph should appear as follows once you have completed steps 8-24: