1
$\begingroup$

I have 20 students, 1000 questions with five options a, b, c, d, e. First, I am using rmultinom(1000,1,c(0.2,0.2,0.2,0.2,0.2) to generate the truth. Next, I want to simulate what a student chooses for each question.

Suppose for Q1, the correct answer is a, I need to simulate the probability of student 1 of choosing the correct answer to be higher than the truth. And then let the choice be uniform for the other 4 choices.

Which probability function should I use to simulate the answers?

$\endgroup$
  • $\begingroup$ Are you sure you want to use multinomial rather then categorical distribution..? $\endgroup$ – Tim Aug 22 '16 at 21:45
  • $\begingroup$ Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. $\endgroup$ – gung - Reinstate Monica Aug 22 '16 at 22:00
  • $\begingroup$ Can you say more about your situation, & your goals? What are you ultimately trying to do & why? People don't usually simulate data one student at a time, eg. $\endgroup$ – gung - Reinstate Monica Aug 22 '16 at 22:06
  • $\begingroup$ @Tim I see I can use categorical distribution to specify the probability of one of those answers. But, I want to simulate the probability of getting each of those answers. Do you think categorical distribution is better? $\endgroup$ – amrapaliz Aug 22 '16 at 22:06
  • 1
    $\begingroup$ This question is obviously a statistical question: What is a reasonable specification for distribution of responses (answers) for an individual? How is this a software question??? $\endgroup$ – not_bonferroni Aug 22 '16 at 22:06
2
$\begingroup$

You have $k$ distinct outcomes, where each can be sampled with some probability. This means that we are talking about categorical distribution that is parametrized by vector of probabilities $\boldsymbol{p} = (p_1,\dots,p_k)$. In your case you want to sample the "correct" answer with probability $\alpha$ and rest of the answers uniformly each with probability $\frac{1-\alpha}{k-1}$. The only question you need to ask yourself is how much likely should the "correct" answer be selected. If it's $1/k$ then you sample all the answers uniformly, if it's greater than you make it more likely. In R you can simulate values from categorical distribution using sample.int(k, n, p, replace = TRUE) where k is the number of categories, n is sample size and p is vector of probabilities, or rcat function from extraDistr package.

However if I were you I'd consider if this is a valid model for simulation. I guess it is rarely the case that either answers are given uniformly, or that single answer is more common while other are uniformly distributed. There are available solutions for model-based simulations, e.g. based on Item Response Theory models that are more realistic than your idea (check e.g. psych package for R)

$\endgroup$
  • $\begingroup$ Thank you @Tim, this is very clear and helpful. I can simulate the categorical distribution now outcomes <- sample(answers, 100, replace=TRUE prob=c(0.1, 0.2, 0.65, 0.05, 0.1)) & then I can get the probability of each answer too. Yes, you are right that it is unlikely that there is uniformity in the answers and that's exactly what I am trying to simulate. $\endgroup$ – amrapaliz Aug 22 '16 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.