I am new to modelling in R. I have a combined matrix with binomial values (0s and 1s) that has been filled in based on different prevalences like so:
prev1 <- 0.10 a <- sapply(1:5 ,function(p) rbinom(500,1,prev1)) prev2 <- 0.80 b <- sapply(1:5 ,function(p) rbinom(500,1,prev2)) prev3 <- 0.10 c <- sapply(1:5 ,function(p) rbinom(500,1,prev3)) matrixA<- cbind(a,b,c)
I would like to plot a histogram of matrix A showing the distribution of the 1s: y axis showing frequency of 1s and x axis showing matrix column numbers. How do I do this? I have tried hist(), plot() and colsums() function but they dont make sense.
Thank you for your help!