parn at nt.ntnu.no
2007-Apr-23 16:47 UTC
[R] test deviation from a binomial distribution - lack of 50:50
Dear R-users, I have a data set where each observation consists of a number of trials (n.trials) that varies between 5 and 7, 6 being most common. Each trial can take either of two outcomes, success or failure. A dummy data set: n.trials <- sample(5:7, 50, replace=T, prob=c(0.2, 0.6, 0.2)) success <- rbinom(50, n.trials, p=0.5) failure <- n.trials - success I know I could test for a deviation from 50:50 success:failure in one or the other direction using a glm with binomial errors. However, I suspect that in my 'real' data set the outcome 50:50 is underrepresented, not due to a skew in one particular direction, but rather that within each observation there are either many successes or many failures. Although I did not manage to create a dummy data set with these properties, which would be the proper way in R to test for a 'lack of 50:50 outcome' using the simple dummy data above as a starting point? Thanks in advance! Henrik --