x d1 y gives the approximations to y using linear regression on x with a polynomial of degree 1. e.g.
d1=: ] (] +/ .* %.) 1: ,. [ x=: 10 [EMAIL PROTECTED] 100 y=: (17 + 3 * x) + 10 [EMAIL PROTECTED] 0 x ,. y ,. x d1 y 90 287.581 287.504 47 158.926 158.515 58 191.155 191.512 29 104.766 104.52 22 83.8745 83.5219 32 113.172 113.519 55 182.511 182.513 5 32.1901 32.5265 55 182.752 182.513 73 236.224 236.508 If just the coefficients (the alpha and beta) are required, %. alone does the job: y %. 1,.x 17.5278 2.99973 If regression using a higher degree polynomial is required, do as follows: y %. x ^/ i.4 16.9363 3.05929 _0.00138775 8.9248e_6 ----- Original Message ----- From: June Kim <[EMAIL PROTECTED]> Date: Saturday, August 19, 2006 6:51 am Subject: [Jprogramming] Linear Least Squares > On 10E. Approximation section of J Dictionary, there is a definition > for "linear least squares fit of x and y". > > It's given as d1=: ] (] +/ .* %.) 1: ,. [ > > What is the expected way of using it, and what does the result > mean? I > first thought it returned the least squares estimators(beta and > alpha), but it didn't. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
