unstudentize.m

来自「计量工具箱」· M 代码 · 共 43 行

M
43
字号
function t = unstudentize(xin,xraw) % PURPOSE: returns reverse studentized vector %          given xin a studentized vector, %          and xraw the vector in raw form % (adds back the mean and multiplies by its standard deviation) %          If x is a matrix, do the above for each column.%---------------------------------------------------% USAGE:   out = unstudentize(xin,xraw)% where:     xin  = a vector or matrix in studentized form%            xraw = a vector or matrix in raw form %---------------------------------------------------% RETURNS:%          out = untransformed matrix or vector% --------------------------------------------------% written by:% James P. LeSage, Dept of Economics% University of Toledo% 2801 W. Bancroft St,% Toledo, OH 43606% jlesage@spatia-econometrics.com    [nobs nvar] = size(xin);  meanx = mean(xraw);  stdx = std(xraw);    if nvar == 1    if (stdx == 0)      t = zeros(size(xin)); else  tmp = xin*stdx;      t = tmp + meanx;    end  elseif nvar > 1    l = ones (rows(xin), 1);    t = matmul(xin,stdx);    t = matadd(t,meanx);  else    error('unstudentize:  x must be a vector or a matrix');  end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?