나는 범주 형 예측 변수와 이진 응답을 사용하여 R에 glm을 작성합니다. 내 데이터는 다음과 같이이다 (하지만 훨씬 더 크고 여러 예측) : R 예측 변수를 glm 및 범주 형 변수와 함께 복제
y <- c(1,1,1,0,0) #response
x <- c(0,0,0,1,2) #predictor
이 데이터 (하지만이 숫자로 표시), 나는이 한 범주이기 때문에
:y <- as.factor(y)
x <- as.factor(x)
그리고 다음을 I 내 모델 구축 :
g1 <- glm(y~x, family=binomial(link="logit"))
그러나 모델의 세부 사항은 다음과 같습니다
g1
Call: glm(formula = y ~ x, family = binomial(link = "logit"))
Coefficients:
(Intercept) x1 x2
24.57 -49.13 -49.13
Degrees of Freedom: 4 Total (i.e. Null); 2 Residual
Null Deviance: 6.73
Residual Deviance: 2.143e-10 AIC: 6
그리고 요약이다 : R은 X1과 X2에있는 X 예측 중복 왜
summary(g1)
Call:
glm(formula = y ~ x, family = binomial(link = "logit"))
Deviance Residuals:
1 2 3 4 5
6.547e-06 6.547e-06 6.547e-06 -6.547e-06 -6.547e-06
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 24.57 75639.11 0 1
x1 -49.13 151278.15 0 1
x2 -49.13 151278.15 0 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 6.7301e+00 on 4 degrees of freedom
Residual deviance: 2.1434e-10 on 2 degrees of freedom
AIC: 6
Number of Fisher Scoring iterations: 23
가 이해가 안 무엇입니까? x1과 x2는 무엇을 의미합니까?
y ~ B0 + B1 * x 형식의 추정치를 명시 적으로 모델에 써야하기 때문에 x가 2로 나뉘어 x1 및 x2 ...
도움 주셔서 감사합니다.