Just Another Statistics Textbook
  • Report an error
  • Request a clarification
  • Suggest Content

Question Maker

  • Welcome
    • About
    • Installing R(Studio)
  • R Basics
    • Types of Scripts
    • R Fundamentals
    • R Logic
  • Statistics Foundations
    • Statistics Basics
    • Scientific Notation
    • Probability (R)
  • Describing Data
    • Central Tendency (R, Python, Excel, JASP)
    • Dispersion (R,Python, Excel, JASP)
  • Distributions
    • Binomial Distribution (R)
    • Normal Distribution
    • Skewness (R,Python)
    • Transforming Data (R)
  • Correlation
    • Correlations (R,Python)
    • Partial Correlations (R,Python)
  • Regressions
    • Simple regression (R)
    • Multiple Regressions (R)
  • General Linear Models
    • General Linear Models and Sum of Squares (R, Python)
    • T-Tests (R, Python incomplete)
    • One Way ANOVA (incomplete)
    • Repeated Measures ANOVAs
    • Mixed ANOVA (incomplete)
    • ANCOVA (incomplete)
  • Categorical
    • Contingency (R)
  • Item analyses
    • Cronbach’s Alpha (R,Python)
  • Multiple testing
    • Family-Wise Error (R)
    • False Discovery Rate(R)
    • FWER, FDR, Positive and Negative effects(R)
  • Permutations
    • Permutations (R)
    • Permutation vs. t tests (incomplete)
  • Excel tutorial
    • Formulas
    • If function
    • Count and countifs function
    • Sum and SumIf
    • Averageifs
    • Anchoring
  • Test yourself
    • All questions
    • Question Maker

Question Maker

If you have any questions you would like to contribute to any of the consolidation questions, this page will help generate the code needed to include them. Alternatively, you can simply suggest a question at:

https://github.com/Reading-Psych/jast/discussions/categories/suggest-content

If you would like to generate the code, please complete the following inputs:

Give your question a unique name. It cannot have a space in it, so use underscores (e.g. “question_1” rather than “question 1”)

viewof question_name = Inputs.text();

Write the question itself here:

viewof question_text = Inputs.text();

What type of question is it?

viewof question_type = Inputs.radio([
  "Multiple choice", 
  "Numeric",
  "Text"
]);

If you selected multiple choice, write the options you would like the user to choose from. Please put a | (known as a “pipe”) character between each option

viewof question_responses = Inputs.text();

What is the correct answer? Be precise in how it’s written.

viewof question_correct   = Inputs.text();
output_string = {
  var accuracy_code = "correct_" + question_name + " = '" + question_correct + "';\n" +
    question_name + "_result = {\n" +
    "  if(" + question_name + "_response == correct_" + question_name + "){\n" +
    "    return 'Correct!';\n" +
    "  } else {\n" +
    "    return 'Incorrect or incomplete.';\n" +
    "  };\n" +
    "}\n" +
    "```\n" +
    "**${" + question_name + "_result}**";
  switch(question_type){
    case "Multiple choice":
      return question_text + "\n" +
        "```{ojs}\n" +
        "//| echo: false\n" +
        "viewof " + question_name + "_response = Inputs.radio(['" + question_responses.split("|").join("','") + "']);\n" +
        accuracy_code;
      break;
    case "Numeric":
      return question_text + "\n" +
        "```{ojs}\n" +
        "//| echo: false\n" +
        "viewof " + question_name + "_response = Inputs.number();\n" +
        accuracy_code;
      break;
    case "Text":
      return question_text + "\n" +
        "```{ojs}\n" +
        "//| echo: false\n" +
        "viewof " + question_name + "_response = Inputs.text();\n" +
        accuracy_code;
      break;
  }  
}
Question code: