2
$\begingroup$

Say I have two vectors:

Action.Taken = c(0,1,0,0,1,1,0,1,0)
Success = c(0,0,0,1,0,1,0,1,0)

The first tells me whether or not a specific action was taken in a trial and the second tells me whether or not that trial succeeded. How would I go analyzing these two vectors to answer the following question: Does taking action (Action.Taken = 1) affect whether or not success is had (Success = 1)? I'd like some measure of significance as an regression/hypothesis testing.

I'm looking for an answer that I can implement using R. I am also quite new to stats, so it would be nice if someone could give me a relatively simple, straightforward answer/example.

Thanks!

$\endgroup$
3
  • 3
    $\begingroup$ Consider the chi-square test for independence. $\endgroup$ Jul 14, 2014 at 21:37
  • $\begingroup$ And the correlation coefficient (phi) that can be computed based on Chi-Square. $\endgroup$
    – rolando2
    Jul 14, 2014 at 21:45
  • $\begingroup$ Yeah, I've actually tried the prop.test function, which returns, among other things, the p-value given the null hypothesis that two (or more) proportions aren't different. I think phi is just as simple as cor(dat), but I don't know what/how much that tells me. $\endgroup$
    – userNaN
    Jul 14, 2014 at 21:51

1 Answer 1

2
$\begingroup$

As TrynnaDoStat says, I'd suggest using the chi-square test for independence. Start with:

contingency = table(Action.Taken, Success) 

This gives you a contingency table, which displays the number of times you have action {1, 0} and success {1,0}. That can tell you whether success is more frequent when some action is taken. Then use:

chisq.test(contingency)

The p-value here tests the null that action taken is independent of success. If the p-value is greater than 0.05 you cannot reject the hypothesis that the two are independent at the 5% significance level. In other words, it doesn't matter what action you take - statistically it seems success is equally likely either way (at the 5% level).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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