Say I want to look at a subset whose age is 55 to 100, to look at their health care costs.
I've used:
Elders <- subset(midus, Age>= 55 | Age<100)
mean(Elders$Cost, na.rm=TRUE)
#78.8445
I understand this should give me the mean cost for people between 55 and 100. In this case, it's 78.8445
Sounds great. BUT, to check, I compare it to ages 95-100:
Elders2<-subset(midus,Age>=95 | Age<100)
mean(Elders2$Cost, na.rm=TRUE)
#78.8445
It seems very unlikely to me that these two subsets have identical means. And I can't figure out what I did wrong to make it think that they do. Anyone have any ideas?
Appreciate the help. I've lurked stack overflow since starting this class and it's helped me immensely.