Skip to content

Instantly share code, notes, and snippets.

@yuu-ito
Created March 24, 2015 03:03
Show Gist options
  • Save yuu-ito/9f72f5fa842bb4032e89 to your computer and use it in GitHub Desktop.
Save yuu-ito/9f72f5fa842bb4032e89 to your computer and use it in GitHub Desktop.
久保みどり本 p.120 ~ 121 図6.4 ロジスティック関数のパラメタを変化させたときの曲線の動き
# p.120
logistic <- function(z){
1 / (1+exp(-z))
}
# z <- seq(-6,6,0.1)
# plot(z,logistic(z),type="l")
x <- seq(-3,3,0.1)
z <- function(x,b_1,b_2){
# z = b_1 + b_2*x
b_1+b_2*x
}
# β_2=2
plot(x, logistic(z(x, 0,2)),type="l")
lines(x,logistic(z(x,-3,2)),type="l",lty="dashed")
lines(x,logistic(z(x, 2,2)),type="l",lty="dotted")
# β_1=0
plot(x, logistic(z(x, 0, 2)),type="l")
lines(x,logistic(z(x, 0, 4)),type="l",lty="dashed")
lines(x,logistic(z(x, 0,-1)),type="l",lty="dotted")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment