Exponential Regression with Expon.txt and Logistic regression with logistic.txt
> e<-read.table("Expon.txt")
> e
V1 V2 V3 V4 V5 V6
1 9 606 41393 3 3.04 6.32
2 6 641 23635 18 1.95 8.89
3 28 505 55475 27 6.54 2.05
…
108 6 817 54429 47 1.90 9.90
109 4 268 34022 54 1.20 9.51
110 6 519 52850 43 2.92 8.62
> y<-e[,1]
> x1<-e[,2]
> x2<-e[,3]
> x3<-e[,4]
> x4<-e[,5]
> x5<-e[,6]
> ee<-data.frame(cbind(y,x1,x2,x3,x4,x5))
> ee
y x1 x2 x3 x4 x5
1 9 606 41393 3 3.04 6.32
2 6 641 23635 18 1.95 8.89
3 28 505 55475 27 6.54 2.05
…
108 6 817 54429 47 1.90 9.90
109 4 268 34022 54 1.20 9.51
110 6 519 52850 43 2.92 8.62
> regexpon<-glm(y~x1+x2+x3+x4+x5,ee,family=poisson)
> summary(regexpon)
Call:
glm(formula = y ~ x1 + x2 + x3 + x4 + x5, family = poisson, data = ee)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.932e+00 -5.887e-01 -9.434e-05 5.927e-01 2.234e+00
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.942e+00 2.072e-01 14.198 < 2e-16 ***
x1 6.058e-04 1.421e-04 4.262 2.02e-05 ***
x2 -1.169e-05 2.112e-06 -5.534 3.13e-08 ***
x3 -3.726e-03 1.782e-03 -2.091 0.0365 *
x4 1.684e-01 2.577e-02 6.534 6.39e-11 ***
x5 -1.288e-01 1.620e-02 -7.948 1.89e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 422.22 on 109 degrees of freedom
Residual deviance: 114.99 on 104 degrees of freedom
AIC: 571.02
Number of Fisher Scoring iterations: 4
> l<-read.table("logistic.txt")
> y<-l[,2]
> x<-l[,1]
> ll<-data.frame(cbind(y,x))
> reglog<-glm(y~x,ll,family=binomial)
> summary(reglog)
Call:
glm(formula = y ~ x, family = binomial, data = ll)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8992 -0.7509 -0.4140 0.7992 1.9624
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.05970 1.25935 -2.430 0.0151 *
x 0.16149 0.06498 2.485 0.0129 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 34.296 on 24 degrees of freedom
Residual deviance: 25.425 on 23 degrees of freedom
AIC: 29.425
Number of Fisher Scoring iterations: 4