DB_REGRES

COMMAND TYPE : GRAPHIC

PURPOSE:

By this command you can display on a graphic terminal a plot or/and a linear regression of pair of fields values present in the catalogues.

DESCRIPTION:

This task draws a scatter diagram of two variables coming from the same catalogue. The two variables can be catalogue fields or functions of catalogue fields (see section for a list of available DIRA2 function) so the user can work on variables that are not inside the catalogue but that are evaluated at the execution time. The user can inquiry the diagram with the cursor to have the values of the catalogue fields of the displayed objects with the 'WHO' command.

Moreover the task performs linear regressions on plotted points. Three regression commands are available. 'REG' and 'RG2' evaluate the regression using the parameters 'VARiable' and 'YVAriable' as independent variable. (Reference: P.R. Bevington, - Data Reduction and Error Analysis for the Physical Sciences - McGraw-Hill Book Company 1969 - Subroutine LINFIT). The 'RGR' command evaluate a regression that uses the variance-on-X/variance-on-Y ratio (Reference: M.G. Kendal, A. Stuart - The Advanced theory of statistics - Griffin London 1943 - Vol 2 - chapter 29).

In the evaluation of the regression (with 'REG' and 'RG2' commands) the task can also take into account the instrumental errors (sigma) or statistical errors (see 'ETYpe' command). In case of instrumental errors these must be present in catalogue field(s) and the field name(s) must be defined by 'XERr' or/and 'YERr' commands. The error bars can be plotted on the diagram for all the data or for a subset only (see 'XBArs' and 'YBArs' commands). When the user has a catalogue field that contains the experimental errors relative to another catalogue field he must pay attention to use functions in the 'VARiable' or 'YVAriable' commands, because the task can not evaluate the relative correct error values. So the user must evaluate a new field (by DB_CALC or by personal program) containing the errors relative to the function that he needs to apply to the data. Only the function LOG10() can be used in 'VARiable' and 'YVAriable' commands without change the errors data. In this case the user must set the 'XLOg' or/and 'YLOg' flags to have relative errors and to have correct error bars on the graphic.

Many catalogues can be superimposed in the diagram, with relative regression lines. The plotted points can be linked with lines (see 'LTYpe'). The user can define coordinates window and constraints on catalogue data.

REQUIRED Parameters Verb
These parameter verbs are required for the execution of the task.

CATalogue   Opens Catalogue
VARiable   Variable on X axis
YVAriable   Variable on Y axis

SPECIFIC VERBS

The task uses all the command verbs defined in section ; moreover specific verbs are :

ETYpe Markers

A code that define the type of error used evaluating the regression; 0 means no error, 1 means instrumental error (the sigma defined in 'XERr' and/or 'YERr'), 2 means statistical error ( 1/SQRT(value) )

Example : REG> ETY 1

HDImension hard copy

This parameter defines the length of the X-axis on the hard copy picture.

Example : REG> HDI 10.4

HYDimension hard copy

You can define the length ( in cm.) of the Y-axis on the hard copy picture. Default is Y-axis = 0.65 * HDImension. Note that not all the graphic libraries allow to modify the scale of the hard copy picture. With this libraries (i.e. GKS) you have a picture with the default scale only.

Example : REG> HYD 10.4

LISt Execute

Writes in a file the values of the dependent and independent variables and the regression parameters.

LTYpe Markers

The markers can be linked by lines when this parameter is set greater than 0. The numbers define the type of line used. When you use this option remember that the lines connect the markers in the order in which these are plotted (the order into file) , so you may want to sort the catalogue on 'VARiable' to have best results.

Example : REG> LTY 2

RG2ression Execute

Calculates the linear regression and draws the line on the screen. The regression is evaluated by least square fit method using 'VARiable' as dependent and 'YVAriable' as independent variable and taking into account error defined by 'XERr', (when 'ETYpe' is set to 1). Only the data of the 'ACTive' catalogue are used. The regression parameters a0, a1, R, Sigma(a0) and Sigma(a1) are written on the screen and into the log file. The function is defined as Y = a0 + a1 * X

Example: REG> RG2

REGression Execute

Calculates the linear regression and draws the line on the screen. The regression is evaluated by least square fit method using 'YVAriable' as dependent and 'VARiable' as independent variable and taking into account error defined by 'YERr' field, (when 'ETYpe' is set to 1). Only the data of the 'ACTive' catalogue are used. The regression parameters a0, a1, R, Sigma(a0) and Sigma(a1) are written on the screen and into the log file. The function is defined as Y = a0 + a1 * X

Example: REG> REG

RGRression Execute

Calculates the linear regression and draws the line on the screen. The regression is evaluated by least square fit method using 'YVAriable' as dependent and 'VARiable' as independent variable. The regression take an account the (Variance-on-Error-X)/ (Variance-on-Error-Y) ratio that is an actual running parameter (greater or equal 0.) that must be entered at the start of the command. The parameters 'XERr', 'YERr', 'ETYpe' have no effect. Only the data of the 'ACTive' catalogue are used. The regression parameters a0, a1, R are written on the screen and into the log file. The function is defined as Y = a0 + a1 * X

The regression parameters are written on the screen and into the log file.

Example: REG> RGR RGR>(Var-Error-X)/(Var-Error-Y) ratio > .5

SQRT Grid and Display

When this flag is set to 1 you have a grid where the X-axis has the same length of the Y-axis. Default is 0.

Example: REG> SQR 1

WHO Cursor Command

You can identify an object using cursor position. The fields defined with the command 'SELect' are printed.

VARiable Variable Parameter

Defines the variable that will be used on the X axis. If you answer ' ? ' at the prompt, you obtain a list of available variables on the catalogue. The VARiable can be a single catalogue field or a function of catalogue fields.

Example: REG> VAR MAG

RGR> VAR LOG10(MAGV - MAGB)

XBArs Markers

The user can decide to plot or not the error bars when he has set the 'XERR' command to take in account the errors on 'VARiable'. When this parameter is set to 0 the error bars are not plotted. Moreover, the user can have many points to plot so the error bars can create confusion on the graphic. Setting this parameters to an integer number N greater than one, not all the points will have the error bar plotted. The default is 1 that means that all the points have the error bars. (See also the 'XERr', 'ETYpe', 'XLOg' commands)

Example: REG> XBArs 5

XERror Markers

Define the name of a catalogue field that contains the values of the error relative to 'VARiable'. With this command you can display the error bars in X and evaluate a regression that take in account the errors when the 'RG2' command is used. (See also the 'XBArs', 'ETYpe', 'XLOg' commands)

Example: REG> XER RADERR

XLOg Markers

When you work on a logarithmic scale in X (you have defined in the 'VARiable' something like LOG10(RADVEL)) and you need to use the relative errors you must set to 1 this flag to have logarithmic errors.

Example: REG> XLOg 1

YBArs Markers

The user can decide to plot the error bars when he has set the 'YERr' command to take in account the errors on 'YVAriable. When this parameter is set to 0 the error bars are not plotted. Moreover, the user can have many points to plot so the error bars can create confusion on the graphic. Setting this parameter to an integer number N greater than one not all the points will have the error bar plotted. The default is 1 that means that all the plotted points have the error bars. (See also the 'YERr', 'ETYpe', 'YLOg' commands)

Example: REG> XBArs 5

YERror Markers

Define the name of a catalogue field that contains the values of the error relative to 'YVAriable'. With this command you can display the error bars in Y and evaluate a regression that take in account the errors when the 'REG' command is used. (See also the 'YBArs', 'ETYpe', 'YLOg' commands)

Example: REG> YER RADERR

YLOg Markers

When you works on a logarithmic scale in Y (you have defined in the 'YVARiable' something like LOG10(RADVEL)) ) and you need to use the relative errors you must define to 1 this flag to have logarithmic errors.

Example: HIS> YLog 1

YMAx Variables

Defines the maximum value for the Y axis and for the dependent variable.

Example: REG> YMAx 120

YMIn Variables

Defines the minimum value for the Y axis and for the dependent variable. Default is 0.

Example: REG> YMIN 10

YVAriable Variable

Defines the variable that you will use on the Y axis. If you answer '?' at the prompt, you get a list of available variables on the catalogue. The YVAriable can be a single catalogue field or a function of catalogue fields.

Example: REG> YVA ABS( MINRAD - MIDIAMB )

DB_REGRES Summary of the commands

* = must be provided by the user

Command Explanation Ref.

---- Execution

ALL Executes GRI and DIS on all cat. Verb AUToscale Calculates max and min Verb AVErage Evaluates average of VAR Verb DISplay Displays Data Verb EXIt Exit from task Verb GO Executes the task Verb GRId Draws the grid Verb LISt Writes a data file Spec REG Regression (least square on Y) Spec RG2 Regression (least square on X) Spec RGR Regression (ratio X/Y errors) Spec SYStem Return to VMS Verb TEXt Draws a string of text Verb

---- Set up and selection

ACTive Defines active catalogue Verb * CATalogue Opens a Catalogue Verb CLOse Closes a catalogue Verb CONstrains Sets constraints on active cat. Verb CVAriable Defines cord. variables name Verb DEC Sets Dec. coordinates limits Verb DWIndow Resets window condition Verb DZOom Resets zoom condition Verb LATitude Sets longitude cord. Verb LONgitude Sets latitude cord. Verb RA Sets R.A. coordinate limits Verb WLAtitude Sets a window in Latitude Verb WLOngitude Sets a window in Longitude Verb WDEc Sets a window in Dec. Verb WRA Sets a window in R.A. Verb

---- Variables

MAXimum Maximum value of VAR Verb MINimum Minimum value of VAR Verb * VARiable Variable used on X axis Spec XERRor Error variable on X axis Spec YERRor Error variable on Y axis Spec YMAximum Maximum value on Y axis Spec YMInimum Minimum value on Y axis Spec * YVAr Variable used on Y axis Spec

---- Grid

DGRid Resets default grid values Verb FONt Font type Verb GCOlor Color of the grid Verb LABels Writes labels near markers Verb LSIze Sets the label size Verb SQRT Flag to have a square grid Spec VFOrmat FORTRAN format of labels in X Verb XSTeps Number of steps on X axis Verb YSTeps Number of steps on Y axis Verb YVFormat FORTRAN format of labels in Y Verb

---- Markers

COLors Color of the markers Verb ETYpe Type of error Spec LTYpe Type of line connecting marks Spec MSIze Marker size (in cm.) Verb SYMbol Markers type Verb XBArs Number of error bars on X Spec XLOg Error when use LOG10() on X Spec YBArs Number of error bars on Y Spec YLOg Error when use LOG10() on Y Spec

---- Cursor

SELect Variable to show in WHO command Spec WHO Finds an object on the screen Spec

---- Screen

CLEar Clears graphic device Verb CLS Clears command monitor Verb MONitor Number of row in command monit. Verb NOWindow Don't draw window box Verb W2 Redraws graphic windows Verb

---- Help

? List of the commands Verb HELp Help of a command Verb LFOnts Shows available fonts Verb LUT Shows available colors Verb SHO Shows a parameter value Verb

---- Hard copy

HARd Executes an hard copy Verb HDEvice Defines hard copy device Verb HDImension Defines hard copy dimensions Spec HYDimension Hard copy Y dimension Spec

---- Log file

BREak Sets a break flag Verb DElete Deletes a log file Verb LOAd Loads an existent log file Verb NEXt Continues the load after a BREak Verb REM Writes a string in the log file Verb SAVe Saves current log file Verb

picture 3



Previous: DB_HISTO
Up: Graphic Commands
Next: DB_SCHART
Previous Page: DB_HISTO
Next Page: DB_SCHART