Main Content

selstruc

Select model order for single-output ARX models

Syntax

nn = selstruc(v)
[nn,vmod] = selstruc(v,c)

Description

Note

Use selstruc for single-output systems only. selstruc supports both single-input and multiple-input systems.

selstruc is a function to help choose a model structure (order) from the information contained in the matrix v obtained as the output from arxstruc or ivstruc.

The default value of c is 'plot'. The plot shows the percentage of the output variance that is not explained by the model as a function of the number of parameters used. Each value shows the best fit for that number of parameters. By clicking in the plot you can examine which orders are of interest. When you click Select, the variable nn is exported to the workspace as the optimal model structure for your choice of number of parameters. Several choices can be made.

c = 'aic' gives no plots, but returns in nn the structure that minimizes

Vmod=log(V(1+2dN))=log(V)+2dN,Nd

where V is the loss function, d is the total number of parameters in the structure in question, and N is the number of data points used for the estimation. log(V)+2dN is the Akaike's Information Criterion (AIC). See aic for more details.

c = 'mdl' returns in nn the structure that minimizes Rissanen's Minimum Description Length (MDL) criterion.

Vmod=V(1+dlog(N)N)

When c equals a numerical value, the structure that minimizes Vmod=V(1+cdN)

is selected.

The output argument vmod has the same format as v, but it contains the logarithms of the accordingly modified criteria.

Examples

collapse all

Create estimation and validation data sets.

load iddata1;
ze = z1(1:150);
zv = z1(151:300);

Generate model-order combinations for estimation, specifying ranges for model orders and delays.

NN = struc(1:3,1:2,2:4);

Estimate ARX models using the instrumental variable method, and compute the loss function for each model order combination.

V = ivstruc(ze,zv,NN);

Select the model order with the best fit to the validation data.

order = selstruc(V,0);

Estimate an ARX model of selected order.

M = iv4(ze,order);

Load estimation and validation data sets and view the variable names.

load co2datatt tte ttv
head(tte,3)
     Time      u1     u2      y1   
    _______    ___    __    _______

    0.5 sec    170    50    -44.302
    1 sec      170    50    -44.675
    1.5 sec    170    50     -45.29

Generate model-order combinations for:

  • na = 2:4

  • nb = 2:5 for the first input, and 1 or 4 for the second input.

  • nk = 1:4 for the first input, and 0 for the second input.

NN = struc(2:4,2:5,[1 4],1:4,0);

Estimate an ARX model for each model order combination.

V = arxstruc(tte,ttv,NN);

Select the model order with the best fit to the validation data.

order = selstruc(V,0)
order = 1×5

     2     4     4     2     0

Estimate an ARX model of selected order.

M = arx(tte,order)
M =
Discrete-time ARX model: A(z)y(t) = B(z)u(t) + e(t)               
  A(z) = 1 - 1.252 z^-1 + 0.302 z^-2                              
                                                                  
  B1(z) = -0.3182 z^-2 - 0.1292 z^-3 + 0.2883 z^-4 + 0.001051 z^-5
                                                                  
  B2(z) = -0.02705 + 0.01948 z^-1 + 0.1695 z^-2 + 0.3278 z^-3     
                                                                  
Sample time: 0.5 seconds
  
Parameterization:
   Polynomial orders:   na=2   nb=[4 4]   nk=[2 0]
   Number of free coefficients: 10
   Use "polydata", "getpvec", "getcov" for parameters and their uncertainties.

Status:                                          
Estimated using ARX on time domain data "tte".   
Fit to estimation data: 88.59% (prediction focus)
FPE: 3.993, MSE: 3.938                           
 

Version History

Introduced before R2006a