1. Home
  2. TRY directive

TRY directive

Displays results of single-term changes to a linear, generalized linear or generalized additive model.

Options

PRINT = string tokens What to print (model, deviance, summary, estimates, correlations, fittedvalues, accumulated, monitoring, changes, confidence); default chan
FACTORIAL = scalar Limit for expansion of model terms; default * i.e. that in previous TERMS statement
POOL = string token Whether to pool ss in accumulated summary between all terms fitted in a linear model (yes, no); default no
DENOMINATOR = string token Whether to base ratios in accumulated summary on rms from model with smallest residual ss or smallest residual ms (ss, ms); default ss
NOMESSAGE = string tokens Which warning messages to suppress (dispersion, leverage, residual, aliasing, marginality, vertical, df, inflation); default *
FPROBABILITY = string token Printing of probabilities for variance and deviance ratios (yes, no); default no
TPROBABILITY = string token Printing of probabilities for t-statistics (yes, no); default no
SELECTION = string tokens Statistics to be displayed in the summary of analysis produced by PRINT=summary, seobservations is relevant only for a Normally distributed response, and %cv only for a gamma-distributed response (%variance, %ss, adjustedr2, r2, seobservations, dispersion, %cv, %meandeviance, %deviance, aic, bic, sic); default %var, seob if DIST=normal, %cv if DIST=gamma, and disp for other distributions
PROBABILITY = scalar Probability level for confidence intervals for parameter estimates; default 0.95

Parameter

    formula List of explanatory variates and factors, or model formula

Description

TRY investigates modifications to the current regression model, which may be linear, generalized linear or generalized additive. Terms in the specified formula are dropped from the current model if they are already there, or are added to it if they are not. It is best to give a TERMS statement before using TRY to define a common set of units for the models to be investigated. If no model is fitted after the TERMS statement, the current model is taken to be the null model.

The default setting, changes, of the PRINT option summarises the effects of the changes after they have all been tried. Other settings request further details of the changed models. These are printed after each change. Genstat then restores the original model before trying the next change.

The options of TRY are otherwise the same as those of the FIT directive, except that there is no CONSTANT option. The accumulated setting of the PRINT option will show only one change at a time. Accumulated summaries produced by later statements will not have any entries for a TRY statement.

Options: PRINT, FACTORIAL, POOL, DENOMINATOR, NOMESSAGE, FPROBABILITY, TPROBABILITY, SELECTION, PROBABILITY.

Parameter: unnamed.

Action with RESTRICT

If a TERMS statement was given before fitting the model, any restrictions on the variates or factors in the model will have been implemented then. So any new restrictions on vectors involved in the model specified by TRY will be ignored. If no TERMS statement has been given and TRY involves new terms not already in the model, restrictions on the variates or factors in these terms will be taken into account and may cause the units involved in the regression to be redefined.

See also

Directives: MODEL, TERMS, FIT, ADD, DROP, SWITCH, STEP.

Procedures: RSCREEN, RSEARCH.

Commands for: Regression analysis.

Example

" Example FIT-4: Loglinear models

  The data concern damage caused by waves to forward sections of
  cargo-carrying ships. To set standards of hull construction,
  the damage risk associated with various factors is assessed.
  (Data from McCullagh & Nelder: Generalized Linear Models p.137.)"

" Define the number of units (or ships) in the survey."
UNITS [NVALUES=40]
" Set up factors to indicate:
  1) the type of ship,
  2) year of construction, and
  3) period of operation."
FACTOR [LABELS=!T(A,B,C,D,E)] Type
& [LABELS=!T('1960-64','1965-69','1970-74','1975-79')] Constrct
& [LABELS=!T('1960-74','1975-79')] Operatn
GENERATE Type,Constrct,Operatn

" Read the number of months service and number of damage incidents."
OPEN '%gendir%/examples/FIT-4.DAT'; CHANNEL=data4
READ [CHANNEL=data4] Service,Damage
CLOSE data4

" The log of the number of months of service is an offset in the model;
  if a category has no years service, a missing value will be
  assigned (with a warning) and the unit will subsequently be ignored."
CALCULATE Logserv = LOG(Service)
" Specify the variable to be modelled, the error distribution,
  the link, and the offset variable."
MODEL [DISTRIBUTION=poisson; LINK=log; OFFSET=Logserv] Damage
" List the terms to be fitted."
TERMS [FACTORIAL=2] Type * Constrct * Operatn

" Fit the main effects."
FIT [PRINT=model,estimates] Type + Constrct + Operatn

" Display the summary of the analysis."
RDISPLAY [PRINT=summary]

" Try adding the two-factor interactions."
TRY [PRINT=accumulated] Type.Constrct + Type.Operatn + Constrct.Operatn

"Summarize the effects of Type of ship adjusting for the other effects"
PREDICT Type
Updated on March 4, 2019

Was this article helpful?