* E435 computer assignment # 6 set nocolor file 11 b:data7-12.dat read(11) price hatch wbase length width height & weight cyl litres gasmpg trans ols price hatch wbase length width height & weight cyl litres gasmpg trans/auxrsq * Principal Components pc hatch wbase length width height weight & cyl litres gasmpg trans/pcomp=pc pcinfo=info ols price pc:1 pc:2 pc:3/pcinfo=info pcomp=pc stat pc:1 pc:2 pc:3 hatch wbase length width height & weight cyl litres gasmpg trans/pcor * Ridge Regression ols price weight cyl litres/auxrsq * "Quick" ridge ols price weight cyl litres/ridge=.2 * Program per SHAZAM manual dim beta 4 10 k 10 * Let Ridge k go from .1 to .9, turn off warning messages set nowarn do #=1,9 genr k:#=.# ?ols price weight cyl litres/ridge=.# coef=beta:# endo genr k:10=0 ?ols price weight cyl litres/coef=beta:10 matrix beta=beta' print k beta * Plot the ridge trace sample 1 10 plot beta:1 beta:2 beta:3 k