• HOME
  • ABOUT
    AD&Co
    AD&Co Staff Vendor Partners News & Events Press Releases AD&Co in the News Contact Us
  • VECTORS™
    ANALYTICS
    Prepayment Credit Valuation RiskProfiler™ CreditProfile™
  • CONSULTING
  • PUBLICATIONS
    & RESEARCH
    The Pipeline The Pipeline Archives Quantitiative Perspectives Library Books & Papers Presentations
  • ONLINE TOOLS
    & REPORTS
    Model Demos Mortgage Analysis & Performance Reporting Market Valuation Reports Trend Reports CreditProfile™
  • VECTORS™
    SUPPORT
    Downloads FAQs Glossary Installation and Version Compatibility Model Description Model Validation Tuning Support User Manuals/Tutorials/Guides Release Notes Developer Support
  • My AD&Co
 
    Quick Links
  • API Integration Coding for Developers

API INTEGRATION CODING FOR DEVELOPERS

TimeSeries Class: adco_TimeSeries

Description

The timeseries class stores vectors of regularly repeated observations. The design is intended to accomodate various frequencies of observation, although only MONTHLY is currently implemented. Associated with the vector of observations is a start-date expressed as a year and a period withing that year (month, 1=January). The data vector can be internal, or external. In the latter case, the extent of the timeseries can not be modified.

Methods

Creation/Destruction

adco_TimeSeries( int NumObs, int SYear, int SPeriod, adco_cEnumElem freq, double* Values = NULL, int maxobs = 0 );

Create a timeseries with the specfied number of observations utilizing the supplied vector of Values. Pre-Allocate maxobs observations worth of storage (zero = use internal default).

adco_TimeSeries( const adco_TimeSeries& ts, int newlength = 0 );

Copy a timeseries, allocating newlength internal storage.

adco_TimeSeries& operator=( const adco_TimeSeries& tsval );

Copy a timeseries, allocating internal storage.

~adco_TimeSeries();

Destroy the timeseries, including internally allocated vector..

Properties

adco_cEnumElem frequency() const { return mFrequency; }

Retrieve the observation frequency of the timeseries. Current only "ADCO_MONTHLY".

int StartPeriod() const { return mStartPeriod; }

Retrieve the start period (month) of the timeseries data.

int StartYear() const { return mStartYear; }

Retrieve the start year of the timeseries data.

int LastYear() const;

Calculate and return the year of the last observation.

int LastPeriod() const;

Calculate and return the period (month) of the last observation.

int Nobs() const { return mNobs; }

Retrieve the number of observations in the time series.

int Length() const { return mLength; }

Return the length of the allocated storage (may be longer than Nobs).

bool InternalStore() const { return mInternalStore; }

True if the observations are stored in an internally allocated vector.

Value Extraction

double* Values() const { return mValues; }

Retrieve a pointer to the values vector.

int GetIdx( int year, int period ) const;

Calculate the offset in the values vector of the specified date. Can throw an invalid index error.

int GetRawIdx( int year, int period ) const;

Calculate the offset in the values vector of the specified date. Can be outside the actual vector, including negative indices.

double GetVal( int year, int period ) const;

Get the value corresponding to the supplied date.

void GetVal( int year, int period, double* vec, int NumObs ) const;

Copy NumObs values into the supplied vector starting at the specified date. Can throw an invalid index error.

Value Modification

void SetVal( int year, int period, double value, int NumObs = 1 );

Replace the value(s) beginning at the specified date for NumObs periods. SetVal can extend the range of the timeseries, but cannot leave any "gaps" in the data.

void SetVal( int year, int period, double* vec, int NumObs );

Replace the value(s) beginning at the specifed date for the NumObs periods. SetVal can extend the range of the timeseries, but cannot leave any "gaps" in the data.

void SetVal( int year, int period, const adco_TimeSeries& TS, int NumObs = 0 );

Replace the values starting at the specified date, copying corresponding elements of the supplied.timeseries.

void SetValFromList( int year, int period, const double* vec );

Set values starting in the specified period. vec is a list of {count, value} pairs terminated by a zero count.

void Extend( int SYear, int SPeriod, int NumObs );

Repeat the last value of the timeseries making it NumObs long..

void Extend( int SYear, int SPeriod, int EYear, int EPeriod );

Repeat the first/last value of the timeseries as necessary to cover the specified range.

void Truncate( int NumObs );

Truncate the timeseries to the specified number of observations (must be less than the current value)..

void Truncate( int EYear, int EPeriod );

Truncate the timeseries to end in the current year. Supplied date must be less than current end date.




65 Bleecker St., Fifth Floor New York NY 10012   tel 212.274.9075   fax 212.274.0545
© 2012 Andrew Davidson & Co., Inc.