Xander,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?Thanks a million!
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 x64Thanks!
import arcpy, os from arcpy import env ws = "c:/Folder/yourFileGeodatabase.gdb" # change this fcName = "yourFC" # change this # fields in input FC fldYear = "Year" fldID = "yourUniqueIDfieldName" # change this fldDepVar = "Rainfall" # change this: Dependent_Variable fldExpVar = "Temperature;..." # 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: # create feature layer for year qDef = "{0} = {1}".format(fldYear,year) fcFL = "Year_{0}".format(year) arcpy.MakeFeatureLayer_management(fc,fcFL,qDef,"#") # perform OLS on feasturelayer fcOLS = "OLS_{0}".format(year) 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))
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.