search for: myfunction_mc

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

2011 Mar 11
1
Generation of random numbers in a function - (Return command)
...rary(plyr) library(reshape2)   filtered_new <- data.frame(product_name = c("P1", "P2", "P3", "P4", "P5"), output_avg = c(22.71078,22.16979,21.34420,20.17421,19.83799), output_stdev = c(23.59924,21.21430,22.01025,18.88877,18.80436)) n <- 100 myfunction_mc = function(product_name, output_avg, output_stdev) { product_usage_borrowing_room_mc = rnorm(n, output_avg, output_stdev) output_avg_mc = mean(product_usage_borrowing_room_mc) output_stdev_mc = sd(product_usage_borrowing_room_mc) return(output_avg_mc ) } result <- dlply(.data = filtered_n...