Created
November 22, 2011 18:13
-
-
Save timriffe/1386406 to your computer and use it in GitHub Desktop.
Abida stats in R stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
means <- c() | |
vars <- c() | |
for (i in 1:20){ | |
tosses <- rbinom(n=2^i,size=1,prob=.5) | |
means[i] <- mean(tosses) | |
vars[i] <- var(tosses) | |
} | |
plot(1:20,vars,type='o') | |
p <-.5 | |
n <- 10 | |
x <- 0:14 | |
poisnums <- rpois(n = 1000, lambda = 5) | |
poistab <- table(poisnums) | |
poistab <- poistab/sum(poistab) | |
x <- as.numeric(names(poistab)) | |
plot(x,poistab) | |
lines(x,dpois(x=x,lambda=5),col="red") | |
sum(dpois(x=x,lambda=5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment