This Least Square Estimation demo contains 3 prgrammes. LSQFT.F ^^^^^^^ * Input is through 'fit.inp' - Record 1 : 3 integers. np- no of parameters in fit nx- size of design vector (dimension of x) nd- number of experiments (data points) for fit - Next nd records contain 'nx+1' floats per record nx are the values of each compnent of x last is the value of of y (the response) Note y=f(X) = f{x(1), x(2), . . . .x(nx) } - Last record : 1 integer if 1 = shift origin to average of data 0 = do not shift origin. * Shifting of origin if employed when not using coded variables (-1 to +1) , can reduce numerical errors * LSQFT.F requires one subroutine 'setf' to be defined. This evaluates the X matrix given all designs. The defaults setf contains: X = {1. x(1) x(2) } for a nx = 2 problem * Output is in 'fit.out' * Also creates another output file 'repeat' This file should exist. It keeps appending to this file. Incase you do not have this file do --> 'touch repeat' DATA.F ^^^^^^ * This program generates 'fit.inp' for LSQFT.F yt = 3 + 2* x(1) + x(2) : is the function * ye = yt + eps; where eps = RN(mu=0, sigma=0.2) Note you may edit the programme to change these defaults. * Everytime you run this programe, it will prompt you for a seed to generate a random number By giving different seeds you can influence data * Output file is 'fit.inp' for 20 designs * You may also use it for 2^k factorial designs AVERAGE.F ^^^^^^^^^ * Supposing you run 'DATA' and 'LSQFT' in a loop by giving different seeds each time. This writes 'b' vector in a file called 'repeat' * AVERAGE reads in 'repeat' and prints out average of all b estimates.