// From http://college.cengage.com/mathematics/brase/understandable_statistics/7e/students/datasets/mlr/frames/frame.html // Thunder Basin Antelope Study // The data (X1, X2, X3, X4) are for each year. // X1 = spring fawn count/100 // X2 = size of adult antelope population/100 // X3 = annual precipitation (inches) // X4 = winter severity index (1=mild,5=severe) // b0:c0 = { "Err", "Est" }; h0 = "Coeff"; fill d0:g1 { "X1", "X2", "X3", "X4", 2.9, 9.2, 13.2, 2, // 8 sets of measured data 2.4, 8.7, 11.5, 3, 2, 7.2, 10.8, 4, 2.3, 8.5, 12.3, 2, 3.2, 9.6, 12.6, 3, 1.9, 6.8, 10.6, 5, 3.4, 9.7, 14.1, 1, 2.1, 7.9, 11.2, 3, , , , , , 10, 10, 1, // predict fawn count for these inputs , 10, 10, 3, , 10, 10, 5 }; {rank,h1:h3} = llsq("data",e1:g8,d1:d8); b1:c8 = { c1-d1, dot($h$1:$h$3,e1:g1) }; h5 = sqrt(dot(b1:b8,b1:b8)); // norm(Err) c10:c12 = { dot($h$1:$h$3,e10:g10) }; // predictions eval; format h "%.6g"; print symbols values;