เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Simulating a logit

Simulations can help us to understand distributions, evaluate our models, and compare study designs. During this exercise, you will simulate a logit distribution. This will allow you to generate data with known parameters. This can be helpful when testing models or comparing study designs (e.g. how many samples do we need to collect?).

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Generalized Linear Models in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Using the plogis() function, convert 0 on the logit scale to a probability. Save the output as p.
  • Using the rbinom function, generate 10 samples (n = 10) with a size of 1 (size = 1) using the probability p.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Convert from the logit scale to a probability
p <- ___

# Simulate a logit 
__
แก้ไขและรันโค้ด