GEOG 6000
Date: 10/07/2015
Sulochan Dhungel
setwd("C:/Users/Sulochan/Copy/Fall 2015/Advance Geo/Assignment 4")
birds = read.csv("island2.csv")
#head(birds)
#summary(birds)
# Incidence = Presence/Absence of species
# Area = Area of island in 1000 km2
# Isolation = Distance to nearest neighboring island in km
# Quality = Estimate of quality of island, based on land cover
pairs(birds)
Based on the scatterplot, it appears that there is relation between bird incidence with area and isolation. The birds seem to be present where the area is larger. Similarly, if the nearest island is closer, more birds are present.
birds.glm1 = glm(incidence ~ area + isolation, data = birds, family = binomial(link = 'logit'))
summary(birds.glm1)
##
## Call:
## glm(formula = incidence ~ area + isolation, family = binomial(link = "logit"),
## data = birds)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8189 -0.3089 0.0490 0.3635 2.1192
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.6417 2.9218 2.273 0.02302 *
## area 0.5807 0.2478 2.344 0.01909 *
## isolation -1.3719 0.4769 -2.877 0.00401 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 68.029 on 49 degrees of freedom
## Residual deviance: 28.402 on 47 degrees of freedom
## AIC: 34.402
##
## Number of Fisher Scoring iterations: 6
The untransformed coefficients for Intercept is 6.6417, for area is 0.5807 and for isolation is -1.3719.
The AIC score is 34.402
newbird <- data.frame(area=5, isolation=6)
pred.birds = predict(birds.glm1, newdata=newbird, type='response', se.fit=TRUE)
pred.birds$fit
## 1
## 0.7881208
pred.birds$se.fit
## 1
## 0.1125028
The predicted value of incidence is 0.78 and the standard error is 0.113.
tsuga = read.csv("tsuga.csv")
#head(tsuga)
tsuga.glm = glm(cover ~ elev + streamdist, data=tsuga, family=poisson(link='log'))
summary(tsuga.glm)
##
## Call:
## glm(formula = cover ~ elev + streamdist, family = poisson(link = "log"),
## data = tsuga)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.31395 -0.82155 -0.07929 0.71900 2.62316
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.622e+00 5.226e-02 31.047 < 2e-16 ***
## elev 8.901e-05 5.653e-05 1.575 0.115
## streamdist -8.963e-04 1.173e-04 -7.641 2.15e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 748.23 on 744 degrees of freedom
## Residual deviance: 687.10 on 742 degrees of freedom
## (1 observation deleted due to missingness)
## AIC: 3150.2
##
## Number of Fisher Scoring iterations: 4
The log-values of the coefficients are 1.622 (Intercept - Highly significant), 8.901e-05 (elevation - not significant), -8.963e-04 (stream distance - highly significant)
THe model AIC is 3150.2
Transformation of coefficients to original (non-log) scale.
coef(tsuga.glm)
## (Intercept) elev streamdist
## 1.622411e+00 8.901257e-05 -8.963237e-04
exp(coef(tsuga.glm))
## (Intercept) elev streamdist
## 5.0652901 1.0000890 0.9991041
Interpretation of the model This model with the coefficients indicate that unit increase in elevation or streamdist has multiplicative effect on abundance. It can also be expressed as
cover = exp(1.6224) * exp(8.9013e-05 * elev) * exp(-8.963e-04 * streamdist)
A physical interpretation would be that increase in abundance of these trees increases exponentially with elevation while the increases reduces with higher values of stream distance.