Field-Map Scripting

4.1.3.2.19 ParameterizeRegressionModel

ParameterizeRegressionModel function


Prototype:

function ParameterizeRegressionModel (TableOrLayer : TObjectWrapper; XAttributeName, YAttributeName, XLabel, YLabel, ChartCaption, ModelType, Options : string,

 out P1, P2, P3, Rcoef, Syx, Count : variant) : boolean;

Description:

Parameterizes the regression model of one dependent variable on one independent variable.

Syntax:

ParameterizeRegressionModel (TableOrLayer, XAttributeName, YAttributeName, XLabel, YLabel, ChartCaption, ModelType, YShift, P1, P2, P3, Rcoef, Syx, Count);


Part

Description


TableOrLayer

Table containing source variables


XAttributeName

The name of attribute used as independent variable


YAttributeName

The name of attribute used as dependent variable


XLabel

Label of x-axes


YLabel

Label of y-axes


ChartCaption

Chart caption


ModelType

String expression defining the type of regression curve


Options

List of input options (see below)


P1

The first parameter of regression curve


P2

The second parameter of regression curve


P3

The third parameter of regression curve. If model with only two parameters is applied, than P3=NULL.


Rcoef

Coefficient of determination


Syx

Standard error


Count

Number of observations used for parameterization of function




Return value:

True/False

Available model types:

Regression model

Function

ModelType

Linear

Y=P1+P2*X

'LINE'

Power

Y=P1*X^P2

'POWER'

Hyper

Y=1/(P1+P2*X)

'HYPER'

HyperX

Y=X/(P1+P2*X)

'HYPERX'

Exponential

Y=P1*exp(P2*X)

'EXP'

Exponential (absolute value)

Y=P1*exp(P2*X)+P3

'EXPABS'

Exponential/Linear

Y=P1*exp(P2*X)+P3*X

'EXPLIN'

2nd Polynomial

Y=P1+P2*X+P3*(X^2)

'POLY2'

Power (absolute value)

Y=P1+P2*X^P3

'POWERABS'

Height curve

Y=exp(P1+P2/X)

'HCURVE'

Mikhaylov

Y=P1*exp(-P2/X)

'MIKHAYLOV'

Freese

Y=exp(P1+P2*ln(x)+P3*X)

'FREESE'

Petterson

Y=1.3+(X/(P1+P2*X))^3

'PETTERSON'

Log

Y=P1+P2*ln(X)

'LOG'


Available input options:

Input option

Description

Syntax

X0

chart x-axis origin (default 0)

'X0=15'

Y0

chart y-axis origin (default 0)

'Y0=10'

YSHIFT

value to be subtracted from Y (i.e., Y=YSHIFT+Function(x)) (default 0)

'YSHIFT=1.3'

SHOWCHART

YES/NO - whether to show chart or not (default YES)

'SHOWCHART=NO'

SHOWEQUATION

YES/NO - whether to show equation of regression in chart or not (default YES)

'SHOWEQUATION=NO'

DOTSIZE

size of dots (default 6)

'DOTSIZE=2'

LINEWIDTH

width of the line (default 3)

'LINEWIDTH=2'

DOTCOLOR

RGB values defining color of dots

'DOTCOLOR=255,0,0'

LINECOLOR

RGB values defining color of line

'LINECOLOR=0,0,255'

BUTTON

AUTO/CLOSE/OKCANCEL - which buttons to show with chart (default AUTO)

'BUTTON=OKCANCEL'

X[index]

X value(s) to be shown in a chart with respective Y value(s)

'X[1]=12.5'

XFORMAT[index]

format of X value label

'XFORMAT[1]=%0.1f cm'

YFORMAT[index]

format of Y value label

'YFORMAT[1]=%0.1f m'



Example:

Task:

Show parameterize regression model.


Data stored in the database.



Script:


var

P1_,P2_,P3_,Rcoef_,Syx_,Count_ :variant;

tb :TFieldMapTableScriptWrapper;


begin

 tb := Trees.GetQueryResult('DBH_mm, Height_m','');


 ParameterizeRegressionModel( tb,

                                               'DBH_mm',

                                               'Height_m',

'DBH, mm',

'Height, m',

                                               Plots['Name'],

                                               'POWER',

'X0=15; SHOWCHART=YES; SHOWEQUATION=NO; LINEWIDTH=17; X[1]=25.0; X[2]=50.0',

                                               P1_,P2_,P3_,Rcoef_,Syx_,Count_)  


   Plots.SetValues('P1;P2;P3;Rcoef;Syx;n',[P1_,P2_,P3_,Rcoef_,Syx_,Count_]);


end.


Output in Field-Map Data Collector:


See also:

Mean; QuadraticMean; WeightedMean; Median; SampleVariance; StandardDeviation; StandardError; MeanError;VarianceOfMean; WeightedSampleVariance; WeightedStandardDeviation; WeightedVarianceOfMean;ConfidenceIntervalOfMean; VarianceOfTotal; ConfidenceIntervalOfTotal; StratifiedConfidenceIntervalOfTotal; SampleSize;ShowDistributionChart; ParameterizeRegressionModel; CalculateModelValue


Example