0
votes

How to calculate 95% confidence interval of a nominal variable. For instance, I have a sample size of 987 (300 smokers, 687 non-smokers). I need to calculate 95% confidence interval for the percentage of smokers in the population.

1
stats.stackexchange.com is a better place for questions not related to any programming language. in any case, you could take a look at this wikipedia article en.wikipedia.org/wiki/Binomial_proportion_confidence_interval - Otto Kässi

1 Answers

1
votes

Do read the Wikipedia link provided by Otto. An easy to use implementation in R can be found in the Hmisc package.

library(Hmisc)
binconf(687, 987,alpha = 0.05)