Examples

This section contains practical examples of queries using the lp_calc block on the CoreLogic Securities data.

Computing current LTV from multiple HPI indicies

<import path="pub.lib.ucl.beta_latest.lib_mbscalc_beta"/>
<insert block="lp_calc"
 sources="balance,ltv,mbs_calc_current_ltv_ofheo,
 mbs_calc_current_ltv_lp,mbs_calc_current_ltv_csw,
 mbs_calc_current_ltv_csw_economy"
 functions="sum,wavg,wavg,wavg,wavg,wavg"
 hpi="ofheo,lp,csw,csw_economy"
 weights="balance,balance,balance,balance,balance"
 sort="down"
 cusips="46630BAR7"/>

Setting default logic override

<import path="pub.lib.ucl.beta_latest.lib_mbscalc_beta" library=""/>
<insert block="lp_calc" calcs="roll_rates" cusips="46630BAR7" 
 default_logic="if((loss_amt_sum<>0 | (has_loss='N' & ots_stat_sum='F' 'R')
 & exception=6)=1; inv_bal_sum; 0)"
 hpi="ofheo"/>

Using a custom block

This example demonstrates the flexibility of the Universal Calculation Library to incorporate both additional data sets and custom analyses. This query uses a 1010data block that is not part of the UCL to link a table.

<import path="pub.lib.ucl.beta_latest.lib_mbscalc_beta" library=""/>
<defblock name="trends" num_fcl="10">
  <link table2="pub.geo.cbsa_new" col="prop_zip" col2="zipcode"/>
  <link table2="pub.fin.corelogic.reas.markettrends.hist"
   col="county_fips,fmonth1"
   col2="region_code,month" type="asof" suffix="_trends">
    <sel value="region_type='COUNTY'"/>
  </link>
  <sel value="foreclosures_trends>{@num_fcl}"/>
</defblock>
<insert block="lp_calc" calcs="roll_rates" custom="trends" cusips="46630BAR7"
 default_logic="if((loss_amt_sum<>0|(has_loss='N'&ots_stat_sum='F' 'R')
 &exception=6)=1; inv_bal_sum; 0)"
 hpi="ofheo"/>

Link an outside table

<import path="pub.lib.ucl.beta_latest.lib_mbscalc_beta" library=""/>
<insert block="lp_calc" 
 sources="hu100,hu100_2000" 
 functions="sum,sum" 
 sort="down" 
 cusips="46630BAR7" 
 link_tables="pub.geo.cbsa_new,pub.enigma.us.gov.census.population.h1.x050" 
 link_from_cols="prop_zip|county_fips" 
 link_to_cols="zipcode|geoid" 
 link_cols="county_fips|hu100,hu100_2000"
 hpi="ofheo"/>

Default summary

<import path="pub.lib.ucl.beta_latest.lib_mbscalc_beta" library=""/>
<insert block="lp_calc" 
 sources="balance,mbs_calc_current_ltv"
 functions="sum,wavg" 
 sort="down"
 weights=",balance" 
 hpi="ofheo"/>