## Copyright (C) 2008 Olaf Till ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA function ret = Rlm (robj, y, x, ylabel, xlabels, Rmodel, alpha) ## ret = Rlm (robj, y, x, ylabel, xlabels, Rmodel, alpha) y = y(:); if (isvector (x)) x = x(:); endif nc = size (x, 2); Rput (robj, cat (2, y, x), "lindata", \ cat (2, {{ylabel}{:}}, {xlabels{:}})); Rprintf (robj, "linmod <- lm (%s, lindata);\n", Rmodel); Rdisp (robj, 1, "confint (linmod, level = %.16e)", 1 - alpha); Rdisp (robj, 0, "coefficients (linmod)"); Rprintf (robj, "library (car)\n"); Rdisp (robj, 0, "linear.hypothesis (linmod, c (0, 1))$Pr[2]"); Rflushin (robj); ret = Rget (robj, 1, nc, 2); ret.coeffs = Rget (robj, 0, nc + 1, 1); % is only a special case!! ret.alpha = Rget (robj, 0, 1, 1); endfunction