|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.stat.UserBasisRegression
public class UserBasisRegression
Fits a linear function of the form , where are the user basis functions evaluated at index values is the intercept, are the coefficients associated with the basis functions, and is the random error associated with y. The coefficients are determined by least squares.
UserBasisRegression
generalizes the concept of linear regression to user
defined basis functions. The linear regression model is
,
where are the k independent variables. UserBasisRegression
generalizes this
concept by setting , where
is any user defined function of .
This makes it easier for users to fit complex univariate models. For
example, the LinearRegression
class can be used to fit polynomials such as
,
but this requires an input matrix where the ith column of that array contains
the values of .
With UserBasisRegression
, these columns can be automatically generated.
For this polynomial model, the user would define a user basis function
. The UserBasisRegression
class
automatically inserts the necessary values into the regression equation and
then calculates the coefficients and analysis of variance statistics.
Since the user provides a method for calculating the basis function, other more
complex user basis functions are possible such as .
In this example, nBasis
=2, , and
.
Constructor Summary | |
---|---|
UserBasisRegression(RegressionBasis basis,
int nBasis,
boolean hasIntercept)
Constructs a UserBasisRegression object |
Method Summary | |
---|---|
ANOVA |
getANOVA()
Get an analysis of variance table and related statistics. |
double[] |
getCoefficients()
Returns the regression coefficients. |
void |
update(double x,
double y,
double w)
Adds a new observation and associated weight to the RegressionBasis object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UserBasisRegression(RegressionBasis basis, int nBasis, boolean hasIntercept)
UserBasisRegression
object
basis
- a RegressionBasis
basis function supplied by the usernBasis
- an int
which specifies the number of basis functionshasIntercept
- a boolean
which specifies whether or not the model
has an interceptMethod Detail |
---|
public ANOVA getANOVA()
ANOVA
table and related statisticspublic double[] getCoefficients()
double
array containing the regression
coefficients. If hasIntercept is false
its length is equal to the number
of variables. If hasIntercept is true
then its length is the number of variables
plus one and the 0-th entry is the value
of the intercept.
SingularMatrixException
- is thrown when the regression
matrix is singular.public void update(double x, double y, double w)
RegressionBasis
object.
x
- a double
containing the independent
(explanatory) variable.y
- a double
containing the dependent (response)
variable.w
- a double
representing the weight
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |