<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OLS and Time in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527668#M7651</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Xander,&lt;BR /&gt;&lt;BR /&gt;Thanks for the help! I have 10 years worth of data. Also, after reading the OLS link you provided, I noticed it said that it is not recommended for predicting binary outcomes. My dependent variable is just that: presence (1) or absence (0) of a species. Should I continue to use OLS? What is the best tool in ArcGIS for predicting binary outcomes?&lt;BR /&gt;&lt;BR /&gt;Thanks a million!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you think there is a relationship between the occurence of a specie and the other data your have (I believe you had rainfall and temperature?). What happens if you plot the rainfall vs the temperature for all polygons where species occur and you also plot this for those polygons where the species don't occur. Do you see any relationship?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you convert the binary data of the occurrences into richer data (count)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I came across this presentation on &lt;/SPAN&gt;&lt;A href="http://www.kenbenoit.net/courses/quant2/Q2_Week7_Binary.pdf"&gt;Models for binary data: Logit and Probit&lt;/A&gt;&lt;SPAN&gt; by Kenneth Benoit, but I don't know if it's useful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Nov 2013 06:09:05 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2013-11-05T06:09:05Z</dc:date>
    <item>
      <title>OLS and Time</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527665#M7648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there are a way to perform OLS only on selected records/years from my feature layer? I am trying to analyze species occurrence over time. I have a "Year" field that denotes different years worth of data. I am using ArcGIS 10.1 SP1 on Win7 x64&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 13:45:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527665#M7648</guid>
      <dc:creator>RobertFord1</dc:creator>
      <dc:date>2013-10-28T13:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: OLS and Time</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527666#M7649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there are a way to perform OLS only on selected records/years from my feature layer? I am trying to analyze species occurrence over time. I have a "Year" field that denotes different years worth of data. I am using ArcGIS 10.1 SP1 on Win7 x64&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have a lot of years in your data you may want to consider using Python:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
from arcpy import env

ws = "c:/Folder/yourFileGeodatabase.gdb" # change this
fcName = "yourFC"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # change this

# fields in input FC
fldYear = "Year"
fldID = "yourUniqueIDfieldName"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # change this
fldDepVar = "Rainfall"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # change this: Dependent_Variable
fldExpVar = "Temperature;..."&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # change this: Explanatory_Variables
Coefficient_Output_Table = "olsCoefTab"
Diagnostic_Output_Table = "olsDiagTab"
olsReport = "c:/Folder/OLSreport"


# set workspace
env.workspace = ws

# create unique set of values in Year field
fc = ws + os.sep + fcName
values = [row[0] for row in arcpy.da.SearchCursor(fc, (fldYear))]
uniqueYears = set(values)


# loop through the values
for year in uniqueYears:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create feature layer for year
&amp;nbsp;&amp;nbsp;&amp;nbsp; qDef = "{0} = {1}".format(fldYear,year)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcFL = "Year_{0}".format(year)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc,fcFL,qDef,"#")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # perform OLS on feasturelayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOLS = "OLS_{0}".format(year)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ols = arcpy.OrdinaryLeastSquares_stats(fcFL, fldID, fcOLS, fldDepVar, fldExpVar, "{0}{1}".format(Coefficient_Output_Table,year),"{0}{1}".format(Diagnostic_Output_Table,year),"{0}{1}.pdf".format(olsReport,year))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code will make a unique list of years, and then loop through the years, create a featurelayer based on that year and perform an OLS on it. The result for the year 2000 will be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;OLS_2000 (OLS featureclass)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;olsCoefTab2000 (Coefficient Output Table)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;olsDiagTab2000 (Diagnostic Output Table)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;OLSreport2000.pdf (OLS report as PDF)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't tested the code. See for more explanation on how to define the required variables for OLS:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//005p00000022000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Ordinary Least Squares (OLS) (Spatial Statistics) &lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527666#M7649</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T22:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: OLS and Time</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527667#M7650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help! I have 10 years worth of data. Also, after reading the OLS link you provided, I noticed it said that it is not recommended for predicting binary outcomes. My dependent variable is just that: presence (1) or absence (0) of a species. Should I continue to use OLS? What is the best tool in ArcGIS for predicting binary outcomes?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a million!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 12:30:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527667#M7650</guid>
      <dc:creator>RobertFord1</dc:creator>
      <dc:date>2013-10-29T12:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: OLS and Time</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527668#M7651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Xander,&lt;BR /&gt;&lt;BR /&gt;Thanks for the help! I have 10 years worth of data. Also, after reading the OLS link you provided, I noticed it said that it is not recommended for predicting binary outcomes. My dependent variable is just that: presence (1) or absence (0) of a species. Should I continue to use OLS? What is the best tool in ArcGIS for predicting binary outcomes?&lt;BR /&gt;&lt;BR /&gt;Thanks a million!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you think there is a relationship between the occurence of a specie and the other data your have (I believe you had rainfall and temperature?). What happens if you plot the rainfall vs the temperature for all polygons where species occur and you also plot this for those polygons where the species don't occur. Do you see any relationship?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you convert the binary data of the occurrences into richer data (count)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I came across this presentation on &lt;/SPAN&gt;&lt;A href="http://www.kenbenoit.net/courses/quant2/Q2_Week7_Binary.pdf"&gt;Models for binary data: Logit and Probit&lt;/A&gt;&lt;SPAN&gt; by Kenneth Benoit, but I don't know if it's useful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Nov 2013 06:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/ols-and-time/m-p/527668#M7651</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2013-11-05T06:09:05Z</dc:date>
    </item>
  </channel>
</rss>

