Home > wafo > wstats > ryates.m

# ryates

## PURPOSE

Reverse Yates' algorithm to give estimated responses

## SYNOPSIS

[y, id]=ryates(ef)

## DESCRIPTION

``` RYATES Reverse Yates' algorithm to give estimated responses

CALL:  y = ryates(ef);

y  = Estimated response given the effects.
ef = vector of average response, main effects and interaction effects.

RYATES applies the reverse Yates' algorithm to the effect EF to obtain
the estimated response. EF is assumed to
be arranged in what is called standard order. (The order of the actual
running should, of course, be random).  EF(1,:) is the
average response and EF(2:end,:) contain the main effects and
interaction effects.

Example:
D = ffd(3);                    % complete 2^3 design in standard order.
y = [60 72 54 68 52 83 45 80]; % Responses to design D.
[ef,id] = yates(y);
y1 = ryates(ef);               % gives the same as Y

See also  ffd```

## CROSS-REFERENCE INFORMATION

This function calls:
 yates Calculates main and interaction effects using Yates' algorithm. error Display message and abort function.
This function is called by:
 fitmodel Fits response by polynomial

## SOURCE CODE

```001 function [y, id]=ryates(ef)
002 %RYATES Reverse Yates' algorithm to give estimated responses
003 %
004 % CALL:  y = ryates(ef);
005 %
006 %  y  = Estimated response given the effects.
007 %  ef = vector of average response, main effects and interaction effects.
008 %
009 % RYATES applies the reverse Yates' algorithm to the effect EF to obtain
010 % the estimated response. EF is assumed to
011 % be arranged in what is called standard order. (The order of the actual
012 % running should, of course, be random).  EF(1,:) is the
013 % average response and EF(2:end,:) contain the main effects and
014 % interaction effects.
015 %
016 % Example:
017 %   D = ffd(3);                    % complete 2^3 design in standard order.
018 %   y = [60 72 54 68 52 83 45 80]; % Responses to design D.
019 %   [ef,id] = yates(y);
020 %   y1 = ryates(ef);               % gives the same as Y
021 %
022 % See also  ffd
023
024
025
026 % Reference
027 % Box, G.E.P, Hunter, W.G. and Hunter, J.S. (1978)
028 % Statistics for experimenters, John Wiley & Sons, pp 342
029
030 % Tested on: Matlab 5.3
031 % History:
032 % By Per A. Brodtkorb 16.03.2001
033
034 error(nargchk(1,2,nargin))
035 sz = size(ef);
036 n  = length(ef);
037 if prod(sz) == n,
038   ef = ef(:);       % Make sure it is a column vector
039 else
040   n = sz(1);        % Number of runs
041 end
042
043 k = log2(n);      % Number of variables.
044 if round(k)~=k, error('The length of EF must be in power of two'), end
045
046 % Reverse yates algorithm:
047 y      = ef*(n/2);
048 y(1,:) = y(1,:)*2;
049 if nargout>1,
050   [y,id] = yates(flipud(y));
051 else
052   y = yates(flipud(y));
053 end
054 y = flipud(y)/2;
055 y(end,:) = y(end,:)*2;
056
057
058 return
059
060
061
062
063```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003