**Econometrics by Simulation**, and kindly contributed to R-bloggers)

(ratiocur <- meancur/sum(meancur))# 25 10 5 1 # 0.31914894 0.17021277 0.08510638 0.42553191# Once again pennies have the highest requirement at 42% of transactions# while quarters are next with 32%. Nickles are the least required with# only 8.5% of the ratio of required coins. # We might also want to know for what percentage of transactions certain# coins are required. We can do this one mostly in our head. Pennies will# be required whenever change is not divisible by 5, thus ~4/5 times.# Quarters will be required whenever the change is greater than 24 cents,# thus ~75/99=757. Dimes will be required when whatever remains # after dividing by quarters is greater than 9 cents, thus ~15/25=60%.# Finally, nickles are required whenever whatever is left after quarters # and dimes is greater or equal to 5. 25 -> 1,2,3,4,x5,x6,x7,x8,x9,0,1,2,# 3,4,x5,x6,x7,x8,x9,0,1,2,3,4 so, ~10/25=40%. # Let’s check.apply(curcount>0, 2, mean)# 25 10 5 1 # 0.7575758 0.6060606 0.4040404 0.8080808 # Thus we can see that though nickles represent a small portion of the# optimal ratio of currency in circulation, the do represent a large# portion of the optimal change patterns required.

**leave a comment**for the author, please follow the link and comment on his blog:

**Econometrics by Simulation**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...