vlt.stats.lm_category
LM_CATEGORY - calculate a linear model for a variable measured in different fixed categories
LM = LM_CATEGORY(TBL, CATEGORIES_NAME, Y_NAME, Y_OP, REFERENCE_CATEGORY, [RANKORDER])
Create a linear model of the property Y_NAME that occurs in a column in
the table TBL. The model fits Y as a function of the categories listed in
the TBL column CATEGORIES_NAME, using REFERENCE_CATEOGORY as a reference.
The raw values in the table are processed through Y_OP, which evaluates a
column of Y elements.
If RANKORDER is provided and is 1, then the ranks (sort order) values of
Y are used instead of the raw values.
Example:
load carsmall
tbl = table(Model_Year,MPG);
Y_op = 'Y'; % just use Y
% compute standard linear model
lm = vlt.stats.lm_category(tbl,'Model_Year','MPG',Y_op,'70',0)
% compute non-parametric linear model
lm_ = vlt.stats.lm_category(tbl,'Model_Year','MPG',Y_op,'70',1)