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

Comparing probits and logits

You learned about probit and logit link function in the previous chapter. Now, you will learn how to plot them together with ggplot2. The purpose of this exercise is to show you that the two are often very similar and also to show you how to change link functions with ggplot2. Your plot, gg_jitter, has been loaded for you and you will use this with geom_smooth(). Also, you will change the colors of your curves and remove the shaded areas to make the plot easier to read.

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

Generalized Linear Models in R

ดูคอร์ส

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

  • Plot a probit curve by setting the first family to use a probit link using binomial(link = 'probit'), the color to 'red', and se to FALSE.
  • Plot a logit curve by setting the first family to use a logit link using binomial(link = 'logit'), the color to 'blue', and se to FALSE.

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

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

# Add geom_smooth() lines for the probit and logit link functions
gg_jitter + 
	___(method = 'glm', 
                method.args = list(___), 
                color = '___', se = ___) +
	___(method = 'glm', 
                method.args = list(___), 
                color = '___', se = ___)
แก้ไขและรันโค้ด