|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.regression.linear.LmProblem
public class LmProblem
This class represents a linear regression or a linear model (LM) problem.
Linear regression models the relationship between a scalar variable y and one or more variables denoted X. In linear regression, models of the unknown parameters are estimated from the data using linear functions. Most commonly, linear regression refers to a model in which the conditional mean of y given the value of y is an affine function of y.
| Field Summary | |
|---|---|
ImmutableMatrix |
A
the design matrix, the regressors, including the intercept if any; each column corresponds to one regressor a n x m matrix |
boolean |
addIntercept
true iff to add an intercept term to the linear regression |
ImmutableMatrix |
wA
the weighted design matrix, w |
ImmutableVector |
weights
the weights to each observation |
ImmutableVector |
wy
the weighted response vector |
ImmutableVector |
y
the response vector; the regressands; the dependent variables a vector of length n |
| Constructor Summary | |
|---|---|
LmProblem(LmProblem that)
Copy constructor. |
|
LmProblem(Vector y,
Matrix X)
Construct a linear regression problem, assuming a constant term (the intercept) equal weights to all observations |
|
LmProblem(Vector y,
Matrix X,
boolean addIntercept)
Construct a linear regression problem, assuming equal weights to all observations. |
|
LmProblem(Vector y,
Matrix X,
boolean addIntercept,
Vector weights)
Construct a linear regression problem. |
|
LmProblem(Vector y,
Matrix X,
Vector weights)
Construct a linear regression problem, assuming a constant term (the intercept). |
|
| Method Summary | |
|---|---|
protected void |
checkInputs()
Check whether this LmProblem instance is valid. |
Matrix |
invOfwAtwA()
(wA' %*% wA)-1 |
int |
nExogenousFactors()
the number of factors, excluding the intercept |
int |
nFactors()
the number of factors, including the intercept if any |
int |
nObs()
the number of observations |
Matrix |
X()
Get a copy of the factor matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final ImmutableVector y
a vector of length n
public final ImmutableVector wy
public final ImmutableMatrix A
a n x m matrix
public final ImmutableMatrix wA
public final boolean addIntercept
true iff to add an intercept term to the linear regression
public final ImmutableVector weights
| Constructor Detail |
|---|
public LmProblem(Vector y,
Matrix X,
boolean addIntercept,
Vector weights)
y - the dependent variablesX - the factorsaddIntercept - true iff to add an intercept term to the linear regressionweights - the weights to each observation
public LmProblem(Vector y,
Matrix X,
Vector weights)
y - the dependent variablesX - the factorsweights - the weights to each observation
public LmProblem(Vector y,
Matrix X,
boolean addIntercept)
y - the dependent variablesX - the factorsaddIntercept - true iff to add an intercept term to the linear regression
public LmProblem(Vector y,
Matrix X)
y - the dependent variablesX - the factorspublic LmProblem(LmProblem that)
that - another LmProblem| Method Detail |
|---|
public int nObs()
public int nFactors()
public int nExogenousFactors()
public Matrix X()
The automatically appended intercept is not included.
public Matrix invOfwAtwA()
protected void checkInputs()
java.lang.IllegalArgumentException - if this problem is invalid
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||