Homework 4
Homework 4
Due: 2022-09-11, 11:59pm
All homework must be submitted via Blackboard. Your answers must be in a MS Word (DOCX) or PDF format. Your submitted document should have sections corresponding to those in this homework.
Please make sure that you have watched the videos and have done the readings.
Except as noted, you should include the Stata output to support your answers. The results should be in
fixed width (typewriter) font.
Include graphs as images in your document. Use the lecture notes as a guide.
1. Bos-Touwen data summary (80%)
Read in the Bos-Touwen data as in the previous homework.
Drop the questionnaire variables using drop PAM* HAD* SF* IP* SSU*
.
-
Make a spineplot of smoking status by gender two ways
spineplot Smoking Gender spineplot Gender Smoking
Both plots are using the same data, but give a different impression. Comment on the pros and cons of each plot if you are interested in how gender affects smoking behavior.
-
Make a spineplot of GFR category and gender (using what you learnt above). If possible, label the GFR categories so that the figure looks nicer.
-
Make a spineplot to examine the association between smoking status and living situation. Comment on what you see.
Make a spineplot of smoking status as living situation and gender vary. Do you see an an association of smoking status with living sitution, once you split by gender? Comment on the graph. -
Make a histogram of age. Calculate the appropriate descriptive summaries and answer the following questions:
- What was the median age in the study?
- Is the distribution skewed, and if so is it positive or negative?
- What is the standard deviation of age?
- Calculate age such that 15% of the study subjects are older than that age.
2. Post on “Coin spins” discussion forum (20%)
Coin flips are used as a randomization device at the start of football games, to settle disputes, or for gambling. In this section you will collect a small dataset by spinning a quarter as described below.
Take a quarter, and balance it on its edge with a finger with the heads facing
you. Then use a flick of your finger to spin the coin on its edge, and wait till
it rests. Note which side is up: use H
to denote heads and T
to denote
tails. Repeat 10 times.
Next repeat the above steps, but with the tails side facing you. In the end record the results as two strings with the first word denoting the results of the spins with heads facing you, and the second one denoting the results of the spins with the tails facing you. Then write the number of heads for each run. It will look something like this.
THTTHHHTTH TTHHTHHHH 5 7
Add any comments on your experience. Did something unexpected or unusual happen? Were there any problems? Were the instructions unclear?
3. Acknowledgements
Please acknowledge individuals who helped you or resources thay were helpful in completing the homework.