0
숫자 변수에서 상호 작용을 사용하여 이항 glm을 플로팅 할 수 있는지 알고 싶습니다. 내 경우 : behv과 조건이 모델숫자 변수에서 상호 작용을 사용하여 이항 glm 플로팅
#Plotting first for behv
x<-d$behv ###Take behv values
x2<-rep(mean(d$condition),length(d_p[,1])) ##Fixed mean condition
# Points
plot(d$mating~d$behv)
#Curve
curve(exp(model$coefficients[1]+model$coefficients[2]*x+model$coefficients[3]*x2)
/(1+exp(model$coefficients[1]+model$coefficients[2]*x+model$coefficients[3]*x2)))
에 중요하지만, 작동하지 않는 상황에서
##Data set artificial
set.seed(20)
d <- data.frame(
mating=sample(0:1, 200, replace=T),
behv = scale(rpois(200,10)),
condition = scale(rnorm(200,5))
)
#Binomial GLM ajusted
model<-glm(mating ~ behv + condition, data=d, family=binomial)
summary(model)
! 다른 올바른 접근법이 있습니까? 그것은 당신의 원하는 출력처럼 보인다
감사