Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: glm
See also: glmselect glmforward glmest glmcore glmstat

Quantlet: glmbackward
Description: glmbackward performs a backward model selection by searching the best of all subset models w.r.t. the AIC or BIC criterion. Optionally, a number of columns can be given, which are always included in the submodels.

Link:
Usage: sel = glmbackward(code,x,y,opt)
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary PLM).
x n x p matrix, the predictor variables.
y n x 1 vector, the response variables.
opt optional, a list with optional input. 'glmbackward' allows the same optional parameters as 'glmest'. Additionally, the following are supported.
opt.fix r x 1, r < p, numbers of columns which should be always included in the model.
opt.shm integer, if exists and =1, some output is produced which indicates how the selection is going on.
opt.crit string, either "aic" or "bic", the selection criterion to use. If not given "aic" is used.
Output:
best p x 5, five best models.
bestcrit list, containing criteria for five best models:
bestcrit.aic 1 x 5, AIC's for five best models.
bestcrit.bic 1 x 5, BIC's for five best models.
bestordcrit list, containing criteria for five best models:
bestordcrit.aic 1 x p or 1 x (p-r), AIC's for five best models for every order.
bestordcrit.bic 1 x p or 1 x (p-r), BIC's for five best models for every order.
bestfit GLM fit for best model, contains b, bv and stat as computed by "glmest".

Note:

Example:
library("glm")
;==========================
;  simulate data
;==========================
n=200
b=1|2|0|0
p=rows(b)
x=normal(n,p)
y=x*b+normal(n)
;==========================
;  GLM model selection
;==========================
shm=1
x=matrix(n)~x
opt=glmopt("shm",1)        ; show selection going
opt=glmopt("fix",1:2,opt)  ; always variables 1,2
modsel=glmbackward("noid",x,y,opt)
modsel.best
modsel.bestcrit

Result:
The best out of 7 possible submodels is determined. The 5 best
models and their AIC's and BIC's are shown.



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006