test 2 Flashcards
1
Q
how to solve this problem:
Find the fraction of smokers and nonsmokers with weights beyond 1σ and 2σ from the mean.
A
- calculate standard deviation:
sd.smoke <- sd(cdc[smoke100==1,]$weight)
- calculate mean:
mean.smoke <- mean(cdc[smoke100==1,]$weight)
- find threshold values for beyond mean:
mean.smoke + sd.smoke
- calculate the number of people beyond the threshold and find the proportion:
sum(weight[smoke100==1] > mean.smoke + sd.smoke)/sum(smoke100==1)
for proportions you divide by the total amount
- this is also only for smokers but you have to repeat for nonsmokers