I'm trying to create (what I thought was a simple question) in a Canvas quiz using the Formula Question.

**Question:**

- "What does it mean when a computer printout reads “p = [pvalue]”? Assume α = 0.05"
*(Where [pvalue] will be a number between 0 and 1)*

**Formula**:

- IF( pvalue < .05, "Reject", "Do not R")

However, it does not work, I'm obviously missing a piece of the logic here but I don't see it, since it works in excel Any help is appreciated. Many thanks!

Samantha E

The IF(condition,true,false) function in Canvas quizzes is much more restricted than the IF() function in Excel.

If you can live with the first item, then it turns out you don't even need the IF() function.

There is a floor() function available.

floor(pvalue-0.05)will return -1 when the pvalue < 0.05 and 0 when the p-value is at least 0.05.2+floor(pvalue-0.05)will return 1 when the pvalue < 0.05 and 2 when the p-value is at least 0.05.Some would argue that you should reject the null hypothesis when pvalue=0.05, but I'll let you be the arbiter of that. If you wanted to reject a pvalue of 0.05, then you could use

if(pvalue-0.05,2+floor(pvalue-0.05),1). This works because when pvalue=0.05, then pvalue-0.05=0 and that's considered a false, so the last argument 1 is returned. If pvalue is anything other than 0.05, then it uses the statement from above that returns 1 when pvalue<0.05 and 2 when pvalue>=0.05. Notice I said >= and not >. However, it will never get to this part when pvalue=0.05, so it really only returns 2 when pvalue > 0.05.There is another write up about using formulas in a blog post I wrote: Looking Up Values in Formula Questions

It's not specifically about the if() function, but it uses it, especially in some of the comments that followed.