>
Member Functions | |||
baseToLast() newObservationVec() |
newRegressionMat() numAdded() |
setBaseToLast() setNewObservationVec() |
setNewRegressionMat() setNumAdded() |
>#include <rw/analytics/regcalc.h> RWAddObservations<double,double> a;
Class RWAddObservations<T,S> holds information about adding observations to a parameter calculation object's base calculation. This information must consist of the following:
The new regression matrix. This is the regression matrix used in the parameter calculation's objects base calculation with the rows representing the added observations appended.
The new observation vector. This is the observation vector used in the parameter calculation object's base calculation with the added observations appended.
The number of observations added.
#include <rw/analytics/lsqqr.h> #include <rw/rstream.h> int main() { // Full model regression matrix. RWGenMat<double> regMat( "6x3 [1 1.3 .54 \ 1 3.5 .65 \ 1 -2.3 .88 \ 1 8.2 .76 \ 1 -4.2 .32 \ 1 2.4 .43]" ); // Reduced model regression matrix. Contains the first 5 // rows of regMat. RWGenMat<double> reducedRegMat( regMat(RWSlice(0,5),RWAll) ); // Full model observation vector. RWMathVec<double> observationVec( "[12.3 15.6 22.3 44.1 32.5 65.2]" ); // Reduced model observation vector. Contains the first 5 // elements of the full model observation vector. RWMathVec<double> reducedObservationVec( observationVec(RWSlice(0,5)) ); RWLeastSqQRCalc calcObject; // Set the base calculation for the parameter calculation // object to the reduced regression matrix. calcObject.setBaseCalc( reducedRegMat, reducedObservationVec ); if ( calcObject.fail() ) { cout << "Parameter calculation for reduced model failed" << endl; return 1; } cout << "Parameters for reduced model:" << calcObject.parameters() << endl; // Add the observation contained in the last row of the full // model regression matrix using the data change class // RWAddObservations. RWAddObservations<double,double> dataChange( regMat, observationVec, 1 ); calcObject.addObsToBaseCalc( dataChange ); if ( calcObject.fail() ) { cout << "Parameter calculation for full model failed" << endl; return 1; } cout << "Parameters for full model:" << calcObject.parameters() << endl; return 0; }>
RWAddObservations();
Default constructor. Constructs an empty RWAddObservations object.
RWAddObservations(const RWAddObservations<T,S>& a);
Copy constructor. Constructs a copy of a.
RWAddObservations(const RWGenMat<T>& r,
const RWMathVec<S>& o, size_t numAdded,
RWBoolean setBaseToLast = FALSE);
Constructs an RWAddObservations object with the given regression matrix and observation vector. It assumes that the matrix r is obtained from the base calculations regression matrix by appending numAdded rows, and that the observation vector o is obtained from the base calculations by appending numAdded values. If setBaseToLast is TRUE, the base calculations regression matrix is set to r.
RWBoolean baseToLast();
Returns TRUE if the base calculation is to be set to the new regression matrix and new observation vector.
const RWMathVec<S>& newObservationVec() const;
Returns the new observation vector.
const RWGenMat<T>& newRegressionMat() const;
Returns the new regression matrix.
int numAdded() const;
Returns the number of observations added.
void setBaseToLast(RWBoolean s);
Sets the base to last option to s.
void setNewObservationVec(const RWMathVec<S>& o);
Sets the new observation to o.
void setNewRegressionMat(const RWGenMat<T>& r);
Sets the new regression matrix to r.
void setNumAdded(int na);
Sets the number of observations added.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.