0
$\begingroup$

This is sort of homework so I'm not really looking for an answer, just pointers.

I have a dataset with 2,871 sample points from an aerial photograph in a GIS. Each random point was scored as being in forest (tree = 1) or not (tree = 0). Using a digital elevation model (DEM) that gave the height to the nearest meter (Elevation.m) one other variable was derived. The other variable was a factor variable describing if the sample point was more or less east facing (E.vs.W. = east) or west facing (E.vs.W. = west).

ex:

E.vs.W,Elevation.m,tree
west,7.896944379,1
west,6.897992018,1
west,-7.314651138,1
west,-10.88583519,1
west,128.6587367,1
west,102.8423517,1
west,205.0537347,1
west,169.6836871,1
west,201.2179048,1
west,210.6947441,1
...

I'm to "explore the variables and their interactions to predict the presence of a tree. Find the best model while showing how it compares to the other models using ΔAIC."

This is what I have:

dat <- read.csv("Data/treeData.csv")
head(dat)
str(dat)

mod1 <- lm(Elevation.m~tree, data=dat)
mod2 <- lm(Elevation.m~E.vs.W, data=dat)
AIC(mod1,mod2)

plot(Elevation.m~E.vs.W, data=dat)

I guess I'm not sure how to pick the "best model". Am I approaching this correctly?

$\endgroup$
2
  • $\begingroup$ You need the homework or self study tag. $\endgroup$ May 1 '18 at 2:04
  • $\begingroup$ There is know certain way to pick a best model unless you were to try every single one of them. Just pick a handful you have talked about in class and compare their error. Look at the independent variable coefficients to get at the "interactions" bit. I would include all variables in different types of models themselves rather than looking at combinations of variables in just one model (such as the linear model you have shown here). $\endgroup$
    – user136768
    May 1 '18 at 2:07
1
$\begingroup$

I don't think you are approaching this correctly - shouldn't your outcome variable be the tree variable? After all, you need to predict the presence of a tree, not elevation!

If your outcome variable is tree, then you'll have to account for the fact that it is a binary variable (i.e., a variable which only takes values such as 0 and 1) and use binary logistic regression to model it as a function of elevation and facing. In other words, you should use the glm() function rather than the lm() function.

The models that you can fit will then look like:

mod1 <- glm(tree ~ Elevation, 
            family = binomial(link='logit'), 
            data = dat)

mod2 <- glm(tree ~ E.vs.W, 
            family = binomial(link='logit'), 
            data = dat)

mod3 <- glm(tree ~ Elevation + E.vs.W, 
            family = binomial(link='logit'), 
            data = dat)

mod4 <- glm(tree ~ Elevation*E.vs.W, 
            family = binomial(link='logit'), 
            data = dat)

The first model predicts tree presence from elevation alone. The second model predicts tree presence from facing. The third model predicts tree presence from both elevation and facing but assumes the effect of elevation on tree presence does not depend on facing and the other way around. The fourth model predicts tree presence from both elevation and facing but assumes the effect of elevation on tree presence depends on facing and the other way around.

You're on the right track with your computation of AIC values - you can pick the best model among the four suggested above as the one with the smallest AIC value.

Once you find the best model, just compute the difference in the AIC values between the best model and each of the remaining models to get your delta AIC.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.