GEOG 566

         Advanced spatial statistics and GIScience

May 4, 2017

Tutorial 1: Using Logistic Regression vs Ordinary Least Squares Regression.

Filed under: Tutorial 1 2017 @ 3:04 pm


  • How is chytrid fungus presence/absence related to the distance from road or trail? I chose this question because humans are known to be one of the primary causes of pathogen transmission.
    • This question involves a relationship between presence or absence of chytrid fungus (dependent variable) and distance from road or trail (explanatory).


  • I attempted to use Logistic Regression and Ordinary Least Squares for my y variable (chytrid presence/absence) related to an x variable (for this I used distance from road or trail) by using python script and R. Although OLS may not be the best test to run for my data, (logistic regression is shown to be the best based on Table 6.1 in the exercise because my x and y are both binary or categorical data) I wanted to try it anyways to see if there was any linear relationship between x and y. The OLS tool also outputs some cool visuals, figures, and plots. This could be useful for someone who has continuous data.


  • To run OLS and Logistic regression, I had to prep my data. I wanted to answer the question, is the presence of Bd more likely near a road or trail (where humans are transporting the pathogen)? Therefore, I had to get distance from sample points to the nearest road. To do this, I first had to bring in multiple layers of roads and trails within Deschutes National Forest given to me by an employee. I used the “Merge” tool to bring all the layers together. My next step was to find the distance from the sample point to the nearest road or trail in my new “merged roads and trails layer”. I used the “Near” tool which generated a value representing the distance from the sample point to the nearest road or trail. Once I had that information, I ran the Ordinary Least Squares tool and logistic regression where I used Bd as my dependent variable, and distance from road as my explanatory variable. Below is my code and used for both OLS and logistic regression.


  • I am not certain whether OLS was useful or not, but I think not because my data was not continuous which violates one of the assumptions of the test. Although my data violates assumptions made by OLS, it backed up results by the logistic regression, showing a relationship between distance from road and Bd presence.However, while the logistic regression model stated a significant difference, OLS stated a non-significant difference.Logistic regression works better for my data and was useful because it showed a significant relationship between the two variables. Below are some figures produced by OLS, and above are the statistical results along with script from both OLS and logistic regression.

Print Friendly, PDF & Email

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

© 2019 GEOG 566   Powered by WordPress MU    Hosted by