....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8

Source:

Gallant, A. Ronald (1987), Nonlinear Statistical Models, 
New York: John Wiley and Sons, pp. 274-290.

....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8

data raw;
  infile "electa.dat";
  input t1 treat base inter peak expend;
  infile "electc1.dat";
  input t2 famsize income sqfeet heatlos range wash dry cac wac;
  infile "electc2.dat";
  input t3 single duplex mobile hwh frez ref;
  t=t1;
  if (t ne t2) or (t ne t3) then put 'error reading data ' t1 t2 t3;
  drop t1 t2 t3;

data electric;  
  set raw;
  if treat=1 then do;  p1=3.90; p2=2.86; p3=1.06;  end;
  if treat=2 then do;  p1=3.90; p2=2.86; p3=1.78;  end;
  if treat=3 then do;  p1=3.90; p2=3.90; p3=1.06;  end;
  if treat=4 then do;  p1=3.90; p2=3.90; p3=1.78;  end;
  if treat=5 then do;  p1=5.06; p2=3.34; p3=1.37;  end;
  if treat=6 then do;  p1=6.56; p2=2.86; p3=1.06;  end;
  if treat=7 then do;  p1=6.56; p2=2.86; p3=1.78;  end;
  if treat=8 then do;  p1=6.56; p2=3.90; p3=1.06;  end;
  if treat=9 then do;  p1=6.56; p2=3.90; p3=1.78;  end;
  y1=log(peak/base);
  y2=log(inter/base);
  y3=log(expend);
  x1=log(p1/expend);
  x2=log(p2/expend);
  x3=log(p3/expend);
  r1=log(p1);
  r2=log(p2);
  r3=log(p3);
  d0=1;
  d1=log((10*p1+6*p2+8*p3)/24);
  d2=log(income);
  d3=log(sqfeet);
  d4=duplex;
  d5=mobile;
  d6=cac*log(heatlos);
  d7=0; if wac>0 then d7=log(wac);
  d8=0; if hwh>0 then d8=log(famsize+1);
  d9=0; if (hwh>0) & (wash>0) then d9=1;
  d10=0; if dry>0 then d10=log(famsize+1);
  d11=0; if ref>0 then d11=log(ref);
  d12=0; if frez>0 then d12=log(frez);
  d13=range;
  keep y1 y2 y3 x1 x2 x3 r1 r2 r3 
    d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13;

....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
