Háskólinn á Bifröst Logo
Háskólinn á Bifröst Logo

104.6.0.QNRM Megindlegar rannsóknaraðferðir 6 ETCS

Kennari: Kári Joensen

Önn: Haustönn 2024

Verkefni 1: Einstaklingsverkefni

Verkefnalýsing

Verkefnið skiptist í tvo hluta, annars vegar úr tölfræði, efni um gagnlíkur sem þið finnið á Canvas [Námsefni / Fyrirlestur 2 / lesefni]. Hins vegar tengist verkefnið hagnýtri framsetningu gagna, sér í lagi grunnatriði í umbreytingumarkinu Markdown.

Part 1 (50%): Statistical Analysis - Calculating Odds and Odds Ratios

A study published in Lancet (Stewart et al., 2021) on eating habits in the United Kingdom revealed that, in 2016-17, 62% of participants reported consuming fish, and 72% reported consuming red meat in the last four days before the survey.

Tasks:

  1. Calculate the odds of:
    1. Fish consumption
    2. Red meat consumption
  2. Calculate the odds ratio comparing fish consumption to meat consumption.

Understanding Odds

The odds of an event occurring is defined as the ratio of the probability that the event will occur to the probability that it will not occur. If p is the probability of an event occurring, then the odds O are given by:

\[ O = \frac{p}{1-p} \]

(1) Calculating Odds for Fish and Red Meat Consumption

a. Odds of Fish Consumption

  • Given that 62% of the participants consumed fish, the probability p of consuming fish is 0.62.
  • Probability of not consuming fish, Q_fish = 1 - 0.62 = 0.38

Using the formula for odds:

\[ \text{Odds of consuming fish} = \frac{P\_fish}{Q\_fish} = \frac{0.62}{0.38} \approx 1.63 \]

Interpretation: The odds of consuming fish are approximately 1.63. This indicates that for every participant who did not consume fish, about 1.63 participants did consume fish.

b. Odds of Red Meat Consumption

  • Given that 72% of the participants consumed red meat, the probability p of consuming red meat is 0.72.
  • Probability of not consuming red meat, Q_meat = 1 - 0.72 = 0.28

Using the formula for odds:

\[ \text{Odds of consuming red meat} = \frac{P\_meat}{Q\_meat} = \frac{0.72}{0.28} \approx 2.57 \]

Interpretation: The odds of consuming red meat are approximately 2.57. This suggests that for every participant who did not consume red meat, about 2.57 participants did consume red meat.

(2) Calculating the Odds Ratio

The odds ratio (OR) is a measure of association between two probabilities. It compares the odds of two events:

\[ \text{Odds Ratio} = \frac{\text{Odds of Fish Consumption}}{\text{Odds of Red Meat Consumption}} \]

Substitute the values:

\[ \text{OR} = \frac{1.63}{2.57} \approx 0.63 \]

Interpretation: The odds ratio of 0.63 < 1 indicates that the odds of consuming fish are 0.63 times the odds of consuming red meat. This suggests that participants were less likely to consume fish compared to red meat in the 4 days before the survey.

Heimild: Statistical Methods for the Social Sciences (2023) by Alan Agresti, 6th edition, Pearson.

##   consumption     odds
## 1        Fish 1.631579
## 2    Red Meat 2.571429

Summary of Results

The analysis shows that the odds of consuming red meat (2.57) are higher than the odds of consuming fish (1.63) among participants in the study. The calculated odds ratio of 0.63 indicates that participants were less likely to consume fish compared to red meat in the four days preceding the survey.

The bar plot visually reinforces this finding by displaying the relative heights of the bars corresponding to fish and red meat consumption, with the bar for red meat being higher, indicating greater odds.

To lighten the topic, here’s a funny illustration depicting the dilemma of choosing between fish and red meat:

Choosing Between Fish and Red Meat

Part 2 (50%): Markdown Tutorial

Í þessum lið verkefnisins ætlum við að læra algengustu skipanir í Markdown. Markdown er ekki forritunarmál, heldur svokallað umbrotsmál, notað til að sníða og setja fram texta á læsilegan hátt. Á vefnum Markdown Tutorial erum við leidd í gegnum átta síður af stuttum æfingu, þar sem við kynnumst öllum helstu táknum og aðferðum Markdown við umbrot texta. Smellið einfaldlega á tengilinn hér að ofan og vinnið ykkur gegnum æfingarnar. Skilið þessum verkhluta frá ykkur á því formi sem lýst er hér í viðauka.

Learning and Applying Markdown

I have successfully completed the Markdown Tutorial and learned various Markdown skills. Throughout this tutorial, I explored key concepts such as:

  • Basic text formatting: Italics, bold, and bold italics.
  • Headers: Different levels of headers to structure documents.
  • Links: Creating inline and reference-style links.
  • Images: Embedding inline and reference-style images.
  • Blockquotes: Highlighting quotes or special notes.
  • Lists: Creating ordered and unordered lists, as well as nested lists.

Thanks to the knowledge gained from lectures, the tutorial website, and the book, along with a lot of practice, I was able to write Part 1 of this assignment in R Studio. It was a lot of fun learning these new skills, and the step-by-step approach made the process accessible and not overwhelming. Even someone like me, who has no prior knowledge of programming, can learn effectively.

Markdown Code Example

Here’s a demonstration of some Markdown code I learned:

Markdown code:

# Example of Markdown Formatting

## Header Level 2

- _Italicized Text_
- **Bold Text**
- _**Bold and Italicized Text**_

### Links and Images

- [Visit Google](https://www.google.com)
- ![Sample Image](https://www.example.com/sample-image.jpg)

> This is a blockquote example.

1. Ordered list item
2. Another item
   - Nested unordered item
3. Final item

Formatted Output:

Example of Markdown Formatting

Header Level 2

  • Italicized Text
  • Bold Text
  • Bold and Italicized Text

Reflection

The Markdown tutorial was an insightful journey, providing me with basic and useful skills in Markdown. I found the exercises engaging and practical, reinforcing the learning objectives. Using Markdown for writing this assignment in R Studio was a great way to apply what I’ve learned, making the text formatting intuitive and the overall document visually appealing.

Complete Markdown Tutorial Script

The complete script from the Markdown tutorial, including all exercises and examples, is attached in PDF format for reference.

Part 2 Screenshot
Part 2 Screenshot