search for: emprob

Displaying 1 result from an estimated 1 matches for "emprob".

2010 Oct 05
3
R-help
...ulate tosses of a pair of dice #from the simulation, the program returns the empirical probability of #observing a double count <- 0 for(j in 1:sim){#begin loop die1 <- sample(1:6,1) print(die1) die2 <- sample(1:6,1) print(die2) count <- ifelse(die1 == die2, count + 1, count) }#end loop emprob <- count/sim return(count,emprob) } #end program   these are the errors that keep coming up: Error in 1:sim : 'sim' is missing   How do I correct this? [[alternative HTML version deleted]]