Database Reference
In-Depth Information
int k = 14;
MillerUpdatingRegression rm = new
MillerUpdatingRegression(k, true );
When new data arrives, the addObservation method takes an array x of
size k and an observed output y :
rm.addObservation(x, y);
To retrieve the current fitted model, the regress method is used. This
returns a RegressionResults class like the
OLDMultipleLinearRegression class that can be used to retrieve
parameters estimates and other values of interest:
double B[] = rm.regress().getParameterEstimates();
Logistic Regression
It is also possible to fit linear models that do not assume normally
distributed observations using a generalized linear model (GLM). In these
models, the observed values y are assumed to come from a distribution in
the exponential family of distributions. This includes many of the named
distributions mentioned in Chapter 9. For example, Poisson regression is
used to model count data.
One of the most popular GLMs is the logistic regression model, which is
used to model the Bernoulli distribution. It is used to model the probability
of an event occurring or of an observation being the member of a class.
There are also extensions to the model for multiclass modeling in which
the outcome is a multinomial distribution rather than the Bernoulli
distribution. Like other linear models, the probability is calculated by taking
a weighted linear combination of the input x values. However, rather than
using this directly, that linear combination is transformed to produce a
valuebetween0and1,asinthefollowingmodificationtothe LinearModel
class:
public double y(double[] x) {
double y = 0;
for(int i=0;i<B.length;i++) y += B[i]*x[i];
Search WWH ::




Custom Search