search for: freq5

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

Did you mean: freq
2010 Jun 23
1
Generation of binomial numbers using a loop
...(0.1, 0.2, 0.3, 0.4, 0.5) frequency = c(100, 75, 45, 30, 25) no_trials = c(10, 8, 6, 4, 2) freq1 = rbinom(frequency[1], no_trials[1], prob[1]) freq2 = rbinom(frequency[2], no_trials[2], prob[2]) freq3 = rbinom(frequency[3], no_trials[3], prob[3]) freq4 = rbinom(frequency[4], no_trials[4], prob[4]) freq5 = rbinom(frequency[5], no_trials[5], prob[5]) total_frequency = c(freq1, freq2, freq3, freq4, freq5) total_frequency = as.numeric(lapply(total_frequency, function(x){replace(x, x == 0, 1)})) This helps me to generate (sum(frequency) = 275) non zero binomial numbers as total_frequency   [1] 1 1...