#Copy and paste this code into an Splus window.
#It DOES NOT WORK if read in using source( ) (because of the scan function)
haddock_matrix(scan(),ncol=3,byrow=T)
24   1   0
25   1   0
26   3   0
27  14   1
28  30   5
29  49  19 
30  60  29
31  50  51
32  70  91
33 108 120
34  88 118
35  84 107
36  68  78
37  37  52
38  33  40
39  12  17
40   5  17
41   6  14
42  10  10
43   1   4
44   6   6
45   2   2
46   1   5
47   0   1

lenclass_haddock[,1]
nfine_haddock[,2]
nwide_haddock[,3]

#On my system, the X11() graphics device is used.
#Delete the next line if you have an alternative graphics device.
X11() 

par(mfrow=c(2,1))
#This automatically plots the fit to the observed proportions 
#and the deviance residuals.
haddock.fit_fit()

#This plots the actual fitted selection curve.
mtext("Haddock data",cex=2,outer=T)
plot(lenclass,lselect(haddock.fit$x),type="l",xlab="Length (cm)",
      ylab="Retention probability",main="Haddock selection by 87 mm mesh") 
abline(h=c(0.25,0.5,0.75),lty=2)