- URL:https://<geoanalytics-url>/GeneralizedLinearRegression
- Version Introduced:10.7
Description
This tool performs generalized linear regression (GLR) to generate predictions or to model a dependent variable's relationship to a set of explanatory variables. The GeneralizedLinearRegression tool can be used to fit continuous (Gaussian and OLS), binary (logistic), and count (Poisson) models.
The following are examples of the types of questions you can answer using this tool:
- What demographic characteristics contribute to high rates of public transportation use?
- Is there a positive relationship between vandalism and burglary?
- Which variables effectively predict 911 call volume? Given future projections, what is the expected demand for emergency response resources?
- What variables affect low birth rates?
Request parameters
Parameter | Details |
---|---|
inputLayer (Required) | The layer containing the dependent and independent variables. Syntax: As described in Feature input, this parameter can be one of the following:
REST Examples
|
featuresToPredict (Optional) | A layer containing features representing locations where estimates should be computed. Each feature in this dataset should contain values for all the explanatory variables specified. The dependent variable for these features will be estimated using the model calibrated for the input layer data. Syntax: As described in Feature input, this parameter can be one of the following:
REST Examples
|
dependentVariable (Required) | The numeric field containing the observed values to be modeled. REST Examples
|
explanatoryVariables (Required) | One or more fields representing independent explanatory variables in the regression model. REST Examples
|
regressionFamily (Required) | Specifies the type of data to be modeled. This parameter can be defined as one of the following:
REST Examples
|
generateCoefficientTable (Optional) | Specifies whether a table with coefficient values will be returned. By default, the coefficient table is not returned. Values: true | false REST Examples
|
explanatoryVariableMatching (Optional) | A list of the explanatoryVariables specified from the inputLayer and their corresponding fields from the featuresToPredict. By default, if an explanatoryVariable is not mapped, it will match to a field with the same name in the featuresToPredict. This parameter is only used if there is a featuresToPredict input. You do not need to use it if the names and types of the fields match between your two input datasets. predictionLayerField is the name of a field specified in the explanatoryVariables parameter and trainingLayerField is the field that will match to the field in the explanatoryVariables parameter. REST Examples
|
dependentMapping (Optional) | A list representing the values used to map to 0 (absence) and 1 (presence) for binary regression. value0 is the string that will be used to represent 0 and value1 is the string that will be used to represent 1. REST Examples
|
outputName (Required) | The task will create a feature service of the results. You define the name of the service. REST Examples
|
context (Optional) | The context parameter contains additional settings that affect task execution. For this task, there are four settings:
|
f | The response format. The default response format is html. Values: html | json |
Example usage
The following is a sample request URL for GeneralizedLinearRegression:
https://machine.domain.com/webadaptor/rest/services/System/GeoAnalyticsTools/GPServer/GeneralizedLinearRegression/submitJob?predictionType=Train&inputLayer={"url":"https://webadaptor.domain.com/server/rest/services/Hurricane/hurricaneTrack2017/0"}&featuresToPredict={"url":"https://webadaptor.domain.com/server/rest/services/Hosted/corpusChristi/0"}&dependentVariable=ShelterCapacity&explanatoryVariables=CityDensity, ShelterLocations®ressionFamily=Binary&generateCoefficientTable=false&explanatoryVariableMatching=[{"predictionLayerField":"Hurricane2019","trainingLayerField":"hurricanesIn2019"},{"predictionLayerField":"ShelterLocations","trainingLayerField":"CorpusChristiShelters"}]&dependentMapping=[{"value0":"Shelter"},{"value1":"NoShelter"}]&outputName=myOutput&context={"extent":{"xmin":-122.68,"ymin":45.53,"xmax":-122.45,"ymax":45.6,"spatialReference":{"wkid":4326}}}&f=json
Response
When you submit a request, the service assigns a unique job ID for the transaction.
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Check job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:
https://<analysis url>/GeneralizedLinearRegression/jobs/<jobId>
Access results
When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:
https://<analysis-url>/GeneralizedLinearRegression/jobs/<jobId>/results/<response type>?token=<your token>&f=json
Response | Description |
---|---|
output | The input features that are fit to the model. The type of feature (table, point, line, or polygon) depends on the input layers.
The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request. The value contains the URL of the feature service layer. See Feature output for more information about how the result layer is accessed. |
outputPredicted | The features predicted using the model. The type of feature (table, point, line, or polygon) depends on the input layers. This result is optional and is only returned when featureToPredict is provided as input.
|
coefficientTable | A table representing the coefficients from the model fit. This result is optional and is only returned when generateCoefficientTable is true.
|
processInfo | The processInfo parameter contains strings that summarize the ForestBasedClassificationAndRegression result. These strings are used for reporting by GeneralizedLinearRegression in Map Viewer. You can create custom reports for your application using these strings. There are four parts in the returned JSON as follows:
|