|
|
1.1 ! root 1: .G1 ! 2: label left "Heights in Feet" "(Median and" "fifth percentiles)" ! 3: label bot "Heights of Boys in U.S., ages 2 to 18" ! 4: cmpft = 30.48 # Centimeters per foot ! 5: minx = 1e12; maxx = -1e12 ! 6: n = sigx = sigx2 = sigy = sigxy = 0 ! 7: copy "boyhts.d" thru { ! 8: line from $1, $2/cmpft to $1, $4/cmpft ! 9: ty = $3/cmpft ! 10: bullet at $1,ty ! 11: n = n+1 ! 12: sigx = sigx+$1; sigx2 = sigx2+$1*$1 ! 13: sigy = sigy+ty; sigxy = sigxy+$1*ty ! 14: minx = min(minx,$1); maxx = max(maxx,$1) ! 15: } ! 16: # Calculate least squares fit and draw it ! 17: slope = (n*sigxy - sigx*sigy) / (n*sigx2 - sigx*sigx) ! 18: inter = (sigy - slope*sigx) / n ! 19: line from minx, slope*minx+inter to maxx, slope*maxx+inter ! 20: .G2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.