Sofie Bøjgaard Thomsen
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Methods 02 - Portfolio Assignment 1 ## Study group 7 #### Amélie Kretschmer, Aya Sofia Nikolajsen, Carl Emil Grum-Nymann, Laura Sørine Voldgaard and Sofie Bøjgaard Thomsen ```{r setup, include=FALSE} knitr::opts_chunk$set(message=FALSE, error=FALSE, warning=FALSE, comment=NA) ``` ## 1. Continuous probability simulation #### Exercise 5.2 from ROS * log weights for men= M=5.13, sd=0.17 * log weights for women= M=4.96, sd=0.20 * 10 adults selected at random step on an elevator with a capacity of 1750 pound *What is the probability of the weight of 10 elevator passengers exceeding the weight limit?* ```{r} exceeding <- 0 all_totals <- c() for(i in 1:1000){ female <- sum(rbinom(10,1,0.5)) male <- 10 - female totfemale <- sum(rlnorm(female, meanlog = 4.96, sdlog = 0.2)) totmale <- sum(rlnorm(male, meanlog = 5.13, sdlog = 0.17)) totalweight <- totfemale + totmale all_totals[i] <- totalweight if(totalweight > 1750){ exceeding <- exceeding + 1 } } print(exceeding/1000) ``` ```{r, include=FALSE} hist_break <- hist(all_totals)$breaks ``` ```{r} color_list <- rep('darkolivegreen1', length(hist_break)) color_list[hist_break >= 1750] <- 'deeppink' hist(all_totals, col=color_list, xlab="Weight of 10 passengers (in pounds)", ylab="Frequence of occuring weight", main="Distribution of weightcomposition of elevator passengers") abline(v=1750, col="blue", lwd=3, lty=2) ``` For exercise 1, we created a for loop to simulate 1000 possible outcomes of the two genders and the total weight when 10 people are in the elevator. For each time the weight exceeded 1750 pounds, the simulation noted that - and therefore the (simulated) probability of the weight exceeding the limit has in one of our simulations been estimated to ... - Future simulations should reveal a similar result. We created a histogram to visualize the distribution of simulations and the number of simulations that exceed the limit of 1750 pounds. ## 2. Propagation of uncertainty #### Exercise 5.6 from ROS * cost savings at \$5 per unit with a standard error of \$4 * size of the market 40000 with a standard error of 10 000 *Estimate of the total amount of money saved by the new product:* ```{r} all_savings <- c() for(i in 1:1000){ unit_savings <- rnorm(1, mean = 5, sd = 4) market_size <- rnorm(1, mean = 40000, sd = 10000) total_savings <- market_size * unit_savings all_savings[i] <- total_savings } hist(all_savings, col="pink", xlab="Amount of money saved by new product (in $)", ylab="Frequency of saved amount", main="Distribution of total savings") mean(all_savings) sd(all_savings) ``` In order to estimate the total amount of money saved by the new product, we created a for loop to simulate 1000 possible scenarios of savings per unit times number of sold products. In one of our simulations we got a mean value of \$ of savings in total with a standard deviation of \$. Future simulations should reveal a similar result. We again visualised the distribution of simulations in a histogram. ## 3. Inference for a ratio of parameters #### Exercise 5.10 from ROS * difference in costs between treatments A and B is estimated at \$600 per patient: * with a standard error of \$400 * based on a regression with 50 degrees of freedom * difference in effectiveness is estimated at 3.0 (on some relevant measure) * with a standard error of 1.0 * based on a regression with 100 degrees of freedom *a. Create 1000 simulation draws of the cost difference and the effectiveness difference, and make a scatterplot of these draws:* ```{r} sd_cost <- sqrt(51)*400 sd_effect <- sqrt(101)*1 cost_dif <- c() effect_dif <- c() for(i in 1:1000){ cost_difference <- rnorm(1, mean = 600, sd = sd_cost) effect_difference <- rnorm(1, mean = 3.0, sd = sd_effect) cost_dif[i] <- cost_difference effect_dif[i] <- effect_difference } plot (cost_dif, effect_dif, col="orange", xlab="Cost difference", ylab="Effect difference", main="Effectiveness difference compared to cost difference") ``` We calculated the sd for cost and effectiveness difference between the treatments A and B using the equation: >SD = sqrt(n+1)*SE Then we created a simulation again, to simulate the cost and effectiveness difference and visualized this in a scatterplot. *b. Use simulation to come up with an estimate, 50% interval, and 95% interval for the incremental cost-effectiveness ratio:* ```{r} effect_of_cost <- cost_dif/effect_dif print(interval50 <- quantile(effect_of_cost, c(.25, .75))) print(interval95 <- quantile(effect_of_cost, c(.025, .975))) ``` Then we calculated the necessary increase in cost to increase effectiveness of the treatment by one unit. Using the quantile(), we found the estimate for a 50% interval, and a 95% interval for the incremental cost-effectiveness ratio. *c. Repeat, changing the standard error on the difference in effectiveness to 2.0:* ```{r} sd_cost_c <- sqrt(51)*400 sd_effect_c <- sqrt(101)*2 cost_dif_c <- c() effect_dif_c <- c() for(i in 1:1000){ cost_difference_c <- rnorm(1, mean = 600, sd = sd_cost_c) effect_difference_c <- rnorm(1, mean = 3.0, sd = sd_effect_c) cost_dif_c[i] <- cost_difference_c effect_dif_c[i] <- effect_difference_c } plot (cost_dif_c, effect_dif_c, col="orange", main="Effectiveness difference compared to cost difference") effect_of_cost_c <- cost_dif_c/effect_dif_c print(interval50_c <- quantile(effect_of_cost_c, c(.25, .75))) print(interval95_c <- quantile(effect_of_cost_c, c(.025, .975))) ``` Here we repeated the process as described above just by changing the calculated variables.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully