# How many nouns in CELEX2 start with each letter: lcounts <- c(1323, 1619, 2713, 1425, 834, 1195, 901, 973, 833, 267, 232, 949, 1466, 561, 546, 2398, 140, 1262, 3322, 1495, 225, 402, 783, 6, 81, 52) lsums <- c(1, cumsum(lcounts)) lvals <- mat.or.vec(26003,1) for (i in 1:26) lvals[lsums[i]:lsums[i+1]] <- i nitems <- 22 ntrials <- 10000 mcounts <- mat.or.vec(ntrials,26) for (i in 1:ntrials){ X <- lvals[1+round(runif(nitems)*26002)] for (j in 1:26) mcounts[i,j] <- sum(X==j) } maxs <- apply(mcounts, 1, max) mgreq <- mat.or.vec(10,1) meq <- mat.or.vec(10,1) for(n in 1:10){ mgreq[n] <- sum(maxs >= n) meq[n] <- sum(maxs == n) } png(file="SpiceNameA%d.png", width=700, height=700) plot(1:10, meq[1:10], xlab="Maximum number same-initial letter words (out of 22 words)", ylab="Count (out of 10,000)", main="Random selection of 22 nouns from English CELEX2", type="b") plot(1:10, mgreq[1:10]/10000, xlab="X or more (of 22) same-initial-letter words", ylab="Proportion of trials", main="Random selection of 22 nouns from English CELEX2", type="b")