13  Assessment 2

A project showing all ILOs, with an emphasis on power simulation

13.1 General Instructions

Your task is to generate a short report demonstrating all ILOs from the course, with a focus on custom function creation, iteration, analysis, and power simulation.

The submission must contain the following:

Your code should demonstrate the following skills:

You must demonstrate the following skills:

13.2 Specific Instructions

13.2.1 Data and Topic

Choose a topic that interests you and find a dataset. You can use shared research data in your field, or from data sources such as the Sustainable Development Goals Data Portal. You must document the source of your data in the report. Choose a simple question that you can answer from this dataset, but remember that you must demonstrate joining two or more files.

13.2.2 Analysis

Answer your question with a simple frequentist analysis, such as a t-test to compare two groups, a correlation to explore the relationship between two variables, or a regression to explore a trend over time. You will not be judged on statistical sophistication, so do not use complex stats or include lots of covariates or controls. Report the outcome of the test using inline code.

13.2.3 Simulation

Create a custom function that simulates the data used in your test. It should have arguments that let you change essential parameters, such as N., mean, SD, or correlation. What constitutes essential parameters will depend on your data and test.

13.2.4 Iteration and Power

Use custom functions and iteration to explore power and sensitivity. For example, you can use the observed effect size and calculate power for a range of sample sizes, or use a fixed sample size to calculate power for a range of effect sizes. Use a plot to communicate this.

13.2.5 Reflection

Reflect on the areas of this report where you used techniques that improve reproducibility and reusability. Include a list of 3 things you did to ensure reproducibility and explain what aspect of reproducibility the feature improves. Do not simply list good coding practices such as consistent indentation. Each explanation should be about 100-200 words.

13.3 AI Declaration

It is School policy to include this specific AI declaration in any work that allows the use of generative AI. You can copy the code below and include it at the end of your assessment.

### Generative AI Declaration

Indicate [YES] or [NO] to all statements below to show how you have used generative AI tools in this assignment. You MUST declare all use of AI and take responsibility for the content of the assignment. We consider it a misuse of generative AI if you do not declare all uses, including initial exploration of the subject, literature searching, writing and editing, corrections for grammar and spelling, as well as any other tasks from the course.

* [YES/NO] Do you take full responsibility for the content of this submission, ensuring its adherence to academic integrity standards and compliance with University and subject-specific regulations regarding generative AI use as detailed in the assessment information sheet?

Did you use AI for:

* [YES/NO] General learning about a topic 
* [YES/NO] Idea generation or scoping of topic or research question
* [YES/NO] Searching and consulting the scientific literature
* [YES/NO] Summarising or explaining primary sources like journal articles
* [YES/NO] Planning the overall structure of a piece of work?
* [YES/NO] Translation of your own text from another language into English
* [YES/NO] Rephrasing your own text at sentence level
* [YES/NO] Language editing for spelling, grammar, clarity or tone
* [YES/NO] Referencing support, for example checking or producing citations, DOIs or formatting
* [YES/NO] Analysis support, for example statistical or qualitative analysis advice or interpreting output
* [YES/NO] Coding assistance, for example writing or debugging code
* [YES/NO] Visuals or media support, for example figures, diagrams, slide layout or transcription of my own * recordings
* [YES/NO] Something else (explain under **Sources of Learning**)
* [YES/NO] Avoided use of AI tools in any way to assist with this assignment or my learning of the topic

13.4 Hints and Tips

  • The html theme used by the demo report is flatly
  • Use a ggplot theme for consistency.
  • You will definitely need to join data, and convert between wide and long. Make sure you do this efficiently, creating the minimum number of extra data tables needed, and not re-creating the same table for different tasks.
  • If you find yourself doing the same thing to many columns, you could probably do it more efficiently by reshaping the data longer first
  • Use pipes to avoid creating many single-use tables.
  • Set argument defaults in custom functions if there is a sensible default value, and leave them without defaults if a user will always have to set that value to use to function.

13.5 Submission

  • Covers: chapters 1-10, emphasising 8-9
  • Worth: 50%
  • Do not put your name in your report; use your student ID as the author.
  • Please submit a zip file containing:
    1. the .rproj file
    2. your reproducible script, named report2_studentID.qmd
    3. any additional files necessary to reproduce your report(e.g., images or bibliography files),
    4. the rendered html report, named report2_studentID.html.

13.6 Marking Rubric

ILO A: Excellent B: Very Good C: Good D: Satisfactory E: Poor
Research & Knowledge
Skills from Chapters 1-3: You demonstrate skills to create reproducible reports and visualise data
Skills from Chapters 4-7: You demonstrate skills to wrangle data
Custom Functions: You create custom functions that correctly implement similar code with small differences.
Iteration: You can repeat the same code efficiently over a data structure
Data Simulation: You can simulate a simple dataset from descriptive statistics
Evaluation
Original Plot: The original plot is appropriate to the question asked
Reflection: Your reflections note valid areas where reproducibility is important, and correctly identify and explain techniques you used to ensure reproduciblity
Communication
Code Clarity: Your code is organised in the quarto script cleanly and clearly, using separate code chunks to intersperse text and relevant code. Your code chunks contain comments that clarify the purpose of the code, but not overly-explaining each step. The names you use for objects are clear, consistent, and concise.
Code Efficiency: While there are many ways to do the same things in R, some ways are more efficient than others. These avoid unnecessary code (e.g., do not load packages you do not use) and redundancy (e.g., do not load or process the data the same way in several places).