The real estate and credit bubble: evidence from Spain

We analyze the determinants of real estate and credit bubbles using a unique borrower-lender matched dataset on mortgage loans in Spain. The dataset contain real estate credit and price conditions (loan principal and spread, and the appraisal and market price) at the mortgage level, matched with borrower characteristics (such as income, labor status and contract) and the lender identity, over the last credit boom and bust. We find that lending standards are softer in the boom than in the bust. Moreover, despite some adjustment in lending conditions in the good times depending on borrower risk, the results suggest too soft lending standards and excessive risk-taking in the boom. For example, mortgage spreads for non-employed are identical to employed borrowers during the boom. Banks with worse corporate governance problems soften even more the standards. Finally, we analyze the mechanism by which banks could increase the supply of mortgage loans despite of regulatory restrictions on LTVs. The evidence is consistent with banks encouraging real estate appraisal firms to introduce an upward bias in appraisal prices (29 %), to meet loan-to-value regulatory thresholds (40 % of mortgages are just bunched on these limits), thus building-up the credit and the real estate bubble.

rower risk, the results suggest too soft lending standards and excessive risk-taking in the boom. For example, mortgage spreads for non-employed are identical to employed borrowers during the boom. Banks with worse corporate governance problems soften even more the standards. Finally, we analyze the mechanism by which banks could increase the supply of mortgage loans despite of regulatory restrictions on LTVs. The evidence is consistent with banks encouraging real estate appraisal firms to introduce an upward bias in appraisal prices (29 %), to meet loan-to-value regulatory thresholds (40 % of mortgages are just bunched on these limits), thus building-up the credit and the real estate bubble.
Keywords Lending standards · Credit supply · Excessive risk-taking · Bank incentives · Conflicts of interest · Moral hazard · Prudential policy · Financial crises · Asset price bubble JEL Classification G01 · G21 · G28

Introduction
In the summer of 2007 the economies of the United States and Western Europe starting suffering bank liquidity and real estate problems, which were followed by a severe banking crisis, with a strong credit reduction and economic recession that still last in Spain. This sequence of events was not unique: Banking crises are recurrent phenomena, often-triggering deep and long-lasting recessions (Reinhart and Rogoff 2009;Schularick and Taylor 2012). A weakening in banks' balance-sheets may lead to a contraction in the supply of credit and to a slowdown in real activity (Bernanke 1983). Moreover, highly leverage non-financial borrowers may face tightened lending conditions in crises due to a debt overhang problem (Myers 1977). Importantly, banking crises are not random exogenous phenomena, but regularly come on the heels of periods of strong credit growth and asset-price bubbles (Kindleberger 1978;Schularick and Taylor 2012;Gourinchas and Obstfeld 2012).
As in other important banking crises in history, the boom and the bust in the housing market, and the associated credit cycle, seem the main drivers of the crises that hit USA, Ireland, UK andSpain, among other countries, in 2007-2008. It is therefore crucial to answer the following questions: Were the lending conditions and standards to housing loans too soft in the boom? Did all banks behave similarly or were there differences? Were pervasive bank incentives present in the boom? Did they contribute to the real estate and credit bubble? If so, how did banks circumvent the regulatory constraints? Did the lending standards tighten in the crisis?
Spain offers an excellent setting to analyze these questions. Spain, a bank dominated economy, suffered one of the highest boom and bust in the housing and credit market over the last 10 years. Household mortgages were at the peak 65 % of the GDP and loans to real estate developers and construction firms accounted for another 45 % of the GDP. Therefore, the size of the loans' pool related directly with real estate activities (production and transactions) amounted to more than 100 % of GDP. Moreover, household debt in Spain (loans to households for mortgages and consumer credit) was 91 % of GDP in 2010, just below 106 % in UK and 95 % in USA, but substantially higher than France and Germany, with 69 and 64 %, respectively. 1 Despite the importance of this concentration of banking risk on the real estate sector, in particular on household mortgage credit, there is scant evidence identifying the channels that explain the real estate and credit booms. The main reason is the lack of individual (loan) borrower-lender matched level data. 2 We have access to a unique dataset obtained from a housing market intermediary on mortgage loans from 2005 to 2010 matched with borrower and lender identity for 30,262 mortgage loans concentrated somewhat in the middle-low distribution part of the price distribution. The loan-level dataset contain the loan price (spread), principal and appraisal value of the house. Moreover, we know the identity of the lender and, therefore, we can classify the lender as a commercial bank, a savings bank (caja de ahorros) and a non-bank financial institution (financiera), and also exploit the variation across banks in the ex-post (revealed) risks that they took (whether banks were rescued or intervened). In addition, we know crucial characteristics of the borrower such as labor contract (temporal vs. permanent), status (employed in the private or public sector or not employed), income, education, age, location, etc. Finally, we have been able to match part of this sample (10.92 %) with a dataset also from the housing market intermediary containing the market price and some characteristics of the dwelling. For this subsample, we have the appraisal, the transaction (market), and the officially registered price for each house.
We first analyze-at the loan level-credit conditions (both loan to values and loan spreads) in both good (2005:Q1-2007:Q2) and bad (2007:Q3-2010:Q4) times, where the turning point in bank liquidity, credit and real estate dynamics starts in the summer of 2007. 3 We find robust evidence that lending conditions and standards were softer in the boom than in the bust. For example, household income and labor contract/status matter more (statistically and economically speaking) for LTV (loan to value) and loan pricing in the bust than in the boom.
Despite some adjustment in lending conditions in the good times depending on household risk, the results suggest too soft lending standards (excessive bank procyclically/risk-taking) in some loan margins in the boom. Controlling for other key borrower variables such as income, workers with temporal contracts get in the boom the same LTVs (both statistically and economically speaking) as workers with permanent contracts in the crisis, instead, temporal workers obtain less LTVs and pay substantially more spreads. As temporal workers are the ones that mainly went unemployed in the crisis period, these results suggest not only ex-ante high risk, but also ex-post. Even more important for credit supply and excessive bank risk-taking, we 1 See Cecchetti et al. (2011), in particular  find that borrowers who are not employed pay identical loan spreads than employed ones in the boom. However, in the crisis period, the difference in spreads is substantially different. Furthermore, we also find that higher LTV did not impact higher loan spreads (and the same for spreads on LTVs) in the boom. 4 All in all, the results in Spain suggest too soft lending standards and excessive risk-taking in the boom.
Finally, controlling for borrowers' fundamentals and other characteristics, we find that rescued banks increase even more the LTVs in the boom than other banks, where banks were rescued either individually at the beginning of the crisis or later in the crisis with the Spanish banking rescue fund for bank restructuring called FROB (Fondo de Reestructuración Ordenada Bancaria). As all these rescued banks were savings banks (cajas), the results suggest that banks with worse corporate governance problems soften even more the lending standards, thereby taking excessive risks in the boom. 5 Our previous results suggest that high LTVs were used for risky borrowers (e.g. temporal workers) and by risky banks (the rescued ones). However, there were regulations and restrictions on LTVs in Spain. How could banks overpass the tough regulation in terms of LTVs? How did banks contribute to the real estate bubble, both in terms of real estate pricing and mortgage loan principals? What were key moral hazard (conflicts of interest) problems that explain the build-up of the credit and real estate bubble in Spain? The specific agency mechanism that inflated the bubble in the US was quite different from the forces at work in the Spanish case. In both cases, lax standards and excessive credit were the ultimate causes of the house price inflation. However, in the case of the US, those lax standards for mortgage granting were the result of perverse 4 Besley et al. (2013) argue that a regression between loan principal (LTV) and spreads can explain whether lending standards are soft or not. Of course, the two variables are endogenous and thus they have to be interpreted without causality implications. However, despite on this limitation, in Besley et al. (2013), who analyze the UK market, there is always a positive significant relationship between loan principal (LTVs) and spreads (in the Spanish case it is only in the crisis period). 5 Only one commercial bank failed, Banco de Valencia, but it was controlled by a caja, Bancaja. Nationalized banks include what is called Group 1 banks, which needed a large capital injection and are controlled by the FROB: Catalunya Banc, BFA-Bankia, and Nova Caixa Galicia (sold to Banesco in 2013) and Banco de Valencia (sold to CaixaBank in 2012). Banks in Group 2 include financial institutions that needed public funds to fill their capital shortfall but the public sector did not get the majority of the capital. That group that received the injection of public funds includes Liberbank, Banco Mare Nostrum, CEISS and Caja3. For all the information regarding the restructuring banking process in Spain during the crisis, including FROB and savings banks, see Bank of Spain's website, in particular: http://www.bde.es/bde/en/secciones/prensa/ infointeres/reestructuracion/. In 2005 there were 46 savings banks (cajas) representing 42 % of total bank assets in Spain. Commercial banks are traditional banks (including foreign banks) that have shareholders as owners of the bank. Cajas on the other hand rely on a general assembly for governance, consisting of representatives of regional and municipal government (politicians), depositors' representatives, and non-governmental organizations such as the Catholic Church, for instance. The general assembly elects a board of directors who look for a professional manager to run the banking business. However, in many cases these bank managers and members of the Board did not have adequate human capital to run these banks (Cunat and Garicano 2010). Commercial banks' profits can either be retained as reserves or pay out as dividends. For the Cajas, the profits are either retained or paid out as social dividend (i.e. to build and run educational facilities, libraries, sport facilities, pensioners' clubs and so on where the Cajas operate). However, despite their differences in governance structures, both commercial banks and Cajas operate under the same regulatory framework and compete against each other in common markets. After the banking restructuring process during the recent crisis, only two tiny cajas remain, all the others partly merged and became commercial banks. incentives in the housing finance sector related with the securitization process, and the possibility of taking out of the banks' balance sheets the securitized mortgages. 6 We show evidence consistent with an alternative channel for Spain: real estate appraisal firms were encouraged to introduce an upward bias in appraisal prices to satisfy their owners or most important clients (banks). The Bank of Spain recommends not to grant credits over 80 % of the value of the property and covered bonds, a crucial source of financing for banks, was possible only if collateralized with residential mortgages with LTVs lower than 80 %. Moreover, it was considered a bad practice in lending if LTVs were higher than 100 %. In fact, the requirements of information of the Bank of Spain ask banks to report the mortgages classified in three categories: 80 % or below; between 80 and 100 %; and above 100 %. Appraisal firms' incentives in Spain were distorted, as financial institutions own most of the appraisal firms (or are the crucial clients for these firms). 7 During the boom period, appraisers had the incentive to approve even an inflated transaction price in order to satisfy its client (financial institutions) by allowing the borrower to obtain a high mortgage principal by adjusting the actual loan to value of the mortgage when the borrower did not have enough resources for the down payment or did have the resources but preferred to borrow more, thereby circumventing regulatory restrictions. As the appraisal price was the price used by financial institutions to determine the loan to value ratio, this artificial increase in appraisal prices permit to draw larger mortgages. All in all, our results suggest that banks encourage real estate appraisal firms to introduce an upward bias in appraisal prices, to meet loan-to-value regulatory thresholds (40 % of loan mortgages are just bunched in these regulatory limits), thus building-up the credit and the real estate bubble. 8 Our paper contributes to the literature in two ways. There are several papers analyzing the lending conditions and standards in the Spanish market (Jiménez et al. 2012(Jiménez et al. , 2013a, but these papers only analyze business loans and do not analyze loan prices. Moreover, there are papers analyzing mortgage loans in other countries; in particular, Besley et al. (2013) analyze UK mortgages, but do not compare lending standards in boom versus bust nor analyze key borrowers' risk characteristics such as temporal or inactive workers (see Peydró 2012), which is our first main contribution to the literature. Finally, we uncover a key mechanism by which banks drive the housing and credit bubble, which is our second main contribution. We identify the specific mechanism that led to the creation of a large credit and housing bubble in Spain. Opposite to the US case, the Spanish banking regulation has a much larger regulatory perimeter for banks than the US, and therefore it did not foster the creation of shadow banking activities. 9 In addition, Spain was pioneer on the use of countercyclical buffers. Despite these 6 For the US case, see Mian and Sufi (2009) and Keys et al. (2010). For the European (including Spain) versus the US case, see Maddaloni and Peydró (2011). 7 An appraiser is supposed to value homes as if they were purchased for cash, without any financial or other incentives to the buyer (Mae 2005(Mae , 2007. Lacour-Little and Malpezzi (2003) find a significant negative correlation between the quality of appraisals and mortgage defaults. Lang and Nakamura (1993) already pointed that, in this case, the bank would require a larger down-payment. 8 See also Garcia-Montalvo (2009). 9 While in the US the business model during that period was "originate to distribute", in Spain the model was "originate to hold". Spain (and Portugal) differed in their regulation of capital requirements from US regulatory constraints, Spain could not avoid a credit and housing bubble. The mechanism did not rely on the lack of incentive for monitoring the quality of mortgages but the ability of financial institutions to influence the valuations of properties by the appraisal companies.
The paper proceeds as follows. Section 2 discusses the Spain's housing and credit boom and bust. Section 3 introduces the characteristics of the unique dataset we use. Section 4 presents and discusses the results. Section 5 concludes.

The housing and credit markets in Spain
During the first decade of this century, Spain has experienced one of the most important housing booms among developed economies. This housing boom was one of the main engines for economic growth in Spain. In fact, during the period 2002-2006 the growth of the construction sector explained around 20 % of GDP growth. During many years, the production of new dwellings in Spain was higher than the sum of the new dwellings in Germany, France and Italy. The boom was the strongest during the period 2005-07. For example, based on the official statistics of the Department of Public Works, housing initiations reached 860.000 dwellings in 2006. Between 1998 and 2007, the housing prices in Spain tripled in nominal terms as reflected by the housing price statistics of the Department of Public Works. The average number of conceded mortgages was of more than 1 million per year. 10 These amounts are quite remarkable if we consider that in Spain the annual average number of households in that period was of 15.5 million.
Likewise, these amounts were also possible by a very strong competition in the mortgage origination business. Spanish financial institutions offered the lowest mortgage rates of the Euro area. In fact during the period 2003-06 the average mortgage rate in the Euro area was 4.51 while the average in Spain was 3.71. The average Euro area mortgage rate was 21 % higher than the Spanish counterpart. Given this small loan spread in Spain, the competition took place through massive origination of mortgage loan principals. This competitive pressure implied that managers of financial institutions could only increase profits drastically by originating a large number of new mortgages.
The economies of different countries have been affected with different degrees of intensity according to their exposure to some of the main drivers of the financial crisis. The excessive dependence of the real estate industry, jointly with a softening of the credit standards, caused that economic and financial crisis hit Spain more severely than to other developed economies. In this context of economic recession in Spain, one of the most controversial issues is the Spanish Mortgage Law, which was approved in 1909, and with a small number of posterior modifications, still applies now to the Spanish mortgage market.
Footnote 9 continued and other European countries. These countries required sponsors to hold the same amount of regulatory capital for assets on balance sheets and for assets in ABCP conduits. Acharya and Schnabl (2010) find that the regulatory capital arbitrage motive for the creation of the shadow banking system was crucial, and thus they find that Spanish and Portuguese banks did not sponsor ABCP conduits. The Spanish mortgages are loans with full-recourse in contrast with the limited recourse mortgages loans in the most states of the US. While in those states the guarantee is the dwelling, this is not so in Spain. In the event of a mortgage foreclosure, the lender seizes mortgagor's dwelling, which is sold at auction at a price generally quite bellow its market price. After that, borrowers still hold a debt consisting in the outstanding mortgage debt minus the auction prize of the dwelling plus the interests for late payment, which are generally quite high. Mortgage foreclosure usually takes a long period (an even more in crisis times); 11 therefore, these interests consist in the accumulation of the monthly payment for the long period priced at an interest rate of 15-20 %. If mortgagors do not hold other real estate properties or businesses that can be included as guarantee in the mortgage contract, lenders will force borrowers to include another person, usually a relative, as a guarantor. The guarantor is responsible of the mortgage monthly payments in the event that borrowers cannot meet these payments. If the guarantor has no earnings or income to take responsibility of these mortgage monthly payments, lenders can seize also guarantor's properties.
To what extent could banks lower credit standards?
The regulation of the Bank of Spain establishes the weights assigned to each type of mortgage credit following the international regulation (Basel). Low risk mortgages (those with a loan to value lower than 80 %) have a lower weight that mortgages with loan to value above that threshold. This means that they require less capital. In addition, banks report to the Bank of Spain their mortgages classified in three groups (below 80, 80-100 and above 100 %). Obviously, having many mortgages above 100 % could trigger some action from the Bank of Spain. In addition, one of the main ways that a financial institution can reduce its minimum amount of capital is to reduce its risk weighted assets. In this sense, financial institutions are encouraged to increase its percentage of mortgages with a loan to value lower than 80 %, and over-appraising is an effective way of doing so.
In the summer of 2007, credit conditions and the real estate market started changing. The Bank of Spain survey on lending conditions and standards show that the tightening of lending conditions came in Spain, as in the whole Euro Area, in the summer of 2007 (see Maddaloni and Peydró 2011). Bank liquidity problems massively increased in August 2007: the ECB injected more than 90 billion dollars on the 9th of August 2007, interbank market spreads massively increased, and bank liquidity problems lead to a tightening of lending conditions to households and firms. 12 In addition, the reduction in transactions in the housing market and new house constructions began in 2007, although the effect on official prices (based on appraisals) was not clear until 2008 because of the particular dynamics of that type of prices.

Data description
We use a unique data set obtained from a housing market intermediary with franchisers in most of the Spanish provinces. This real estate company also possesses its own mortgage brokerage branch. For instance, this company made 6,528 sales in 2012 which was 4 % of the total sales in Spain during that year. Our data is not strictly representative of all the universe of houses sold during the Spanish bubble period. The intermediary that provided the information is not uniformly represented in Spain. It has more branches in large cities and metropolitan areas around large cities. In addition, our sample does not cover the whole distribution of house prices. We missed the upper part of the distribution. For instance, in the city of Barcelona there are no observations on Pedralbes, which is the neighbourhood with the highest house prices. However, this does not seem to affect the average prices. Table 1 shows the comparison of the appraisal prices of our dataset with the appraisal prices obtained from the Department of Public Works (DPW), 13 for the cities where the housing market intermediary has a very large sample. It corresponds to the second semester of 2012. Appraisal prices are the only variable that we can compare with a population variable (in fact the data of the DPW is not the population of appraisals but it is quite close). The table shows very small deviation in appraisal prices between our sample and the population of appraisals that compiles the DPW. The difference is only 3.2 % for the average of these cities. Therefore, and making clear that we are not claiming that our sample is fully representative of the population of all the transacted properties of the years under study, we believe there are not reasons to expect that the difference would be much larger in other places not included in the table (except for sampling variability). Note that the price statistics of the DPW do not include either the upper tail of the distribution (as it excludes dwellings with a price over 1.05 million Euros); but we believe these expensive dwellings (as the Pedralbes' ones in our sample) are not the representative ones.
The table also compares our market price with the registered prices by the INE (which come from the Official Registry of the Property). We cannot compare the levels because the INE only provides an index based on 2007. Notice also that these two variables do not represent the exact same measure because of the existence of undeclared money in many transactions that are registered in Official Registry of the Property, whereas in our case we also have the market prices that the mortgagor paid. Despite these differences, the change in the index is quite similar.
From the brokerage branch, we could access to the data corresponding to 30,262 mortgage loans originated between 2005 and 2010 (mortgage sample), which include information on loan and borrower characteristics, including real estate appraisal value and lender identity. We divide the full sample into two sub-periods: The first sub-period corresponds to 2005Q1-2007Q2 (boom period) whereas the second sub-period covers 2007Q3-2010Q4 (bust period), with 25,041 and 5,221 observations respectively.
For a subsample of 3,305 observations we can match this information with the information provided by the real estate branch of the intermediary group. For this subsample (matched sample), besides of the individual and financial information we have data on the characteristics of the dwelling including the actual market (transaction) price.
As we mentioned in the Introduction, the first objective of the paper is to test lending standards in boom and bust periods. In order to do this we are going to focus our attention on the determinants of two key variables: the loan to (appraisal) house value ratio (LTV) and the loan price (spread). For the LTVs, we use appraisal price as both the loan principal and the appraisal price are partly controlled by the lender (endogenous variables), and also because we have market prices only for a small subsample of mortgages.
We estimate reduced-form equations for both variables in boom and bust periods separately, using the mortgage sample, which contains broadly the following information: the issuance date, the characteristics of the loan (both principal and price), the appraisal value of the house and its location, the identity of the lender and, finally, several borrower characteristics such as income, labor status, labor contract type, age, marital status, education level and number of holders.
In the first two columns of Appendix Tables A.1 and A.2 (mortgage sample), we present descriptive statistics of the variables used in the empirical analysis: the characteristics of the loans in Table A.1 and the socio-demographic characteristics of the borrowers in Table A.2. We observe that the number of granted loans decreases in bad times and, at the same time, the risk quality of the borrowers increase. Thus the summary statistics suggest a credit reduction and a fly to quality in crisis versus good times.
Our dependent variable in our first equation is LTV that is the ratio of loan to appraisal house value. The average LTV in boom period is 82.52 and 78.37 % in bust period. 14 In terms of the price of the loan we have two sources of information: the type of benchmark rate and spread. Lenders use as benchmark interest rates either the Reference Interest for Mortgage Loans (RIML) or the Euribor. In our sample, 84 % of the loans were priced using Euribor. Spread, defined as the difference between the gross loan rate and the reference rate, is our dependent variable in the second equation. Average spread in boom period is 0.86 and it is 0.88 in bust period.
We include several borrower characteristics that enable us to infer the risk profile of the borrower in the equations to be estimated. 15 The first variable is household's monthly income with an average just above 1,600 e in both boom and bust periods. Secondly, our dataset provides information on borrower's labor status and the type of contract if occupied. From labor status information we know whether the borrower is working in private sector, in public sector, self-employed or not working and, moreover, for those who are occupied, the labor contract type information enables us to identify borrowers working with a permanent contract, or with a temporary contract. We merged the private sector category with the self-employed category and thus selfemployed borrowers are assumed to have a permanent contract. In both periods, our sample mainly consists of active workers and the share of the borrowers working with a temporary contract is 36 % in boom period and 25 % in bust period.
The loans in the sample period are originated by 86 lenders. As we know the identity of the lender, we are able to classify each lender broadly in three groups: commercial banks (21), savings banks (51), or non-bank financial institutions (14). Moreover, as we want to exploit the different lending behavior of rescued savings banks, we further split them into sub-groups. We define the first group as individually rescued as the financial institutions that were individually taken over by the Spanish Central Bank (SCB). And secondly, we have also distinguished banks which are owned by FROB (11 institutions). We observe that half of our sample loans, in both periods, are originated by saving banks and 30 % of the loans were issued in the boom by institutions now owned by FROB.
In terms of the characteristics of the house, apart from the appraisal value we also have information on its location. We distinguish between coastal and interior provinces (including a dummy for Madrid). In both periods, almost half of the houses purchased (11,186 out of 25,041 in boom period and 2,463 out of 5,221 in bust period) are located in coastal provinces.
The remaining variables in both equations are mainly controls and include other borrower characteristics (marital status, education, age and number of holders) and year and Madrid dummies.
Also, as mentioned in the Introduction, the second objective of the paper is to identify the mechanism that led to the housing bubble in Spain. In order to do this we are going to use the aforementioned matched sample which is a subsample of dwellings of the mortgage sample for which besides the individual and financial information we also have data on the transaction price and the characteristics of the dwelling provided by the real estate branch of the business group. In the third and fourth columns of Appendix Tables A.1 and A.2, we report the descriptive statistics of this matched sample, which contains 3,305 observations. The most important thing to highlight is the similarity of the descriptive values in both the mortgage sample and the matched sample. Not only are the mean values from the financial variables very similar in both samples, but also the mean values of the individual characteristics. In this sense, the matched sample can be treated as a random subsample from the mortgage sample. The average transaction price (156,005 e) is considerably lower than the appraisal value (195,214 e). As a result, the appraisal to transaction price ratio is, for the whole period, 1.29. This fact may suggest an overappraising behavior by the financial institutions, issue which will be discussed in more detail in the next section.

Results
We first provide the results on lending conditions and standards in boom and bust periods, and then we analyze the particular mechanism by which banks in Spain influenced the housing and credit bubble.

Lending conditions and standards
In Table 2 we present the regression results of the loan to (appraisal) value equation for boom and bust periods respectively. We use the appraisal value instead of the transaction price as both loan principal and appraisal value may be chosen by the bank (endogenous), whereas the transaction value is not. Additionally, we are interested in comparing the estimates for both periods and the sample for the bust period in the matched sample is very small (453 observations) to obtain significant estimates. In the Table 3 we analyze loan spreads.
When comparing the two sets of results we can point out that we can distinguish two types of variables in terms of its effect on the loan to value ratio and spread: those with a significant change in its effect between these two boom and crisis periods and those with a similar effect in both periods.
The most relevant results are those corresponding to the variables whose effect changes significantly between boom and bust periods, suggesting that the standards and conditions for the housing loans in boom were at least softer, or in some cases, too soft. In the boom period there was no difference between having a temporary job or a permanent one for LTVs. These soft lending standards changed significantly in the bust period. Those with a temporary job were receiving loans with a substantial smaller LTV ratio compared to those with a permanent contract. 16 As temporal workers went massively into unemployment in the crisis, as compared to permanent workers, then loan defaults will be higher and, hence, not only ex-ante, but also ex-post bank risk has to be higher.
Even more important for credit supply and bank risk-taking, we find that in good times loan spreads for private sector employees are identical to those for borrowers who do not work (whereas in bad times there are substantial differences, both statically   Constant is included but its coefficient is left unreported. Robust standard errors are in parentheses * , ** , *** Indicate statistical significance at the 1, 5 and 10 % level, respectively and economically speaking). That is, the results suggest that the lending standards were not only softer in the boom than in the crisis period, but also that lending standards were too soft in the boom, thus leading to excessive bank risk-taking.  Constant is included but its coefficient is left unreported. Robust standard errors are in parentheses * , ** , *** Indicate statistical significance at the 1, 5 and 10 % level, respectively Another crucial result in the LTV equation is that corresponding to the effect of the type of financial institution is giving the loan. The coefficient of the dummy for the non-bank financial companies shows that these institutions are giving higher LTV ratios than commercial banks in both periods (more than 4 % points). But the most striking result is that savings banks which were rescued during the crisis with the Spanish Banking Rescue Fund (FROB) or even rescued individually took excessive risk in the boom period by increasing LTV ratios. In the bust period, these banks behave similarly to the commercial banks and to the other rescued savings banks. Importantly, the non-rescued saving banks were taken a less risky position than the rescued saving banks, on average the LTV's associated to the mortgages they were negotiating were approximately identical to the ones corresponding to commercial banks.
In column 1 and 2, we also find that there was no compensating effect of the spread in that period (non-significant coefficient) whereas the coefficient was only significant (positive) in the crisis period, i.e. higher differentials were compensating for higher loan to value ratios (see Besley et al. 2013 andPeydró 2012, for the UK analysis). Importantly, as columns 3 and 4 as compared to 1 and 2 show, the results on the main coefficients (as e.g. employment or income) are not affected when we control for spreads or not on the right hand side.
When looking at the estimation results of the spread equation (Table 3), we find higher spreads in the boom period for non-bank financial companies and for institutions that were rescued during the crisis with the Spanish Banks Rescue Fund (FROB). Again this result seems a counterpart of setting riskier loans.

A key mechanism for excessive risk-taking
As we have observed in the data section, during the period analyzed, appraisal prices were significantly higher than actual transaction prices. That is, the appraisal to transaction price ratio was 1.29, i.e. in other words there is an over-appraising of 29 %. Although there was also some over-appraisal in the USA, Ben-David (2011) shows that this is a minor issue there. This author concludes that only 2.1 % of the transaction analyzed (more than 700.000) had signs of over-appraisal. This proportion was 3.4 % for LTV above 80 and 4.3 % for LTV over 95 %. Moreover, even for the largest LTV (over 100 %, which represents 2.1 % of all the mortgages) the average over-appraisal was only 6.6 %. For lower LTVs the over-appraisal is even smaller. Therefore, the small proportion of transactions affected by over-appraisal and the small increase in appraisal prices conditional on having over-appraisal imply that this issue we find for Spain is not very relevant in the US.
The loan to appraisal value ratio is a very important ratio since banking regulation imposes penalties in terms of weighted assets to mortgages with LTV above 80 % and even more penalties for ratios above 100 %. The ownership of appraisal firms by banks derived in perverse incentives that adjusted the appraisal values to the bank incentives, instead of reflecting the real value of the properties. This mechanism is very dangerous since delinquency rates increase exponentially with higher loan principals and, in Spain given that loans are with full recourse, households defaulting on loans will obtain lower prices than the appraisals ones (even without a burst of real estate prices).
The key second result for this last part of the paper is shown in Fig. 1. It shows that the loan to appraisal value ratio is bimodal (80 and 100 %), with more than 40 % of mortgages in these two numbers, and with very low frequencies above 100 %. These two modes correspond to the regulatory thresholds mentioned above. 17 Moreover, this bimodal profile is not observed when we look at the distribution of the loan to transaction price ratio. These two pieces of information, over-appraisal and bimodal profile, are giving the evidence of the manipulation on appraisal values that lead to the real estate price and credit bubble.
In order to analyze whether the over-appraising mechanism described in this point is related to some characteristics of either the borrower or the loan, we estimate a reduced form equation (using the same variables we used in the previous subsection) of the determinants of the upward bias in appraisal prices, which can be defined as the ratio of the appraisal price and the market price of the dwelling.
Results for both the whole sample and boom period are reported in Table 4. Comments are based on the estimation using the subsample (second column of Table  4) given that there are no relevant differences in both sets of estimates. The estimates provided reveal that most of the variables behave accordingly to expectations. With respect to the individual characteristics we expect that upward bias in appraisal prices will be negatively correlated with income, age, university degree and permanent contract. 18 All these cases are supposed to have less financial constraints. In those cases, it was more likely that appraisal prices get close to market prices than in the rest of the cases.
Otherwise, be a university graduate reduces the upward bias in 4.01 percentage points with respect to primary studies in the boom period. Likewise, being older decreases the upward bias. Finally, a higher real income increases upward bias (from 1.028 points for every 1,000 e). A higher income could be capturing unobserv- Constant is included but its coefficient is left unreported. Robust standard errors are in parentheses * , ** , *** Indicate statistical significance at the 1, 5 and 10 % level, respectively able characteristics such as higher financial skills, higher future income or higher financial knowledge that makes lenders trust or, even, to provide incentives for overappraising. As expected, a higher spread is correlated with a higher ratio among appraisal and transaction prices. Thus, we have found evidence of higher interest rates in terms of compensation for the risk assumed with a loan with a higher over-appraising (either for increase the total amount of mortgage or to reduce the loan to value to an stan-dard value). In particular, an increase of 1 percentage point in differential results in an increase of 5.7 percentage points in the ratio between appraisal and transaction prices.
In addition, when Euribor is the benchmark interest rate, the ratio between appraisal and transaction prices decreases in 5.4 percentage points. This result brings evidence that lenders tends to use RIML for riskier mortgages. By construction, the RIML is not only higher but also less volatile and react less intensively to changes in the market interest rates than the Euribor. This circumstance makes the RIML more advantageous for lenders, especially for riskier borrowers. As a result, we use this variable to capture unobserved characteristics of the riskier borrowers. In this sense we expect negative sign for the Euribor variable.
Finally, financial institutions have had different behavior towards risk during the boom period. In this specification we found evidence for a higher upward bias (of 3.7 percentage points) in individually rescued institutions and a smaller bias for nonbank financial companies (10.5 percentage points), FROB owned institutions (10.2 percentage points) and the rest of the savings banks (10.9 percentage points) with respect to commercial banks. As pointed out previously, from this result we cannot infer that commercial banks behavior was riskier than savings and loans and non-bank financial companies.
From the models estimated previously we can infer that, for the boom period, non-bank financial companies, FROB owned institutions and individually rescued companies dealt with riskier mortgages, in the sense of higher loan to value, than commercial banks and the rest of savings banks. In the case of individually rescued institutions, not only loans were riskier but we also find a higher upward bias than for other financial institutions (except for commercial banks).

Conclusions
We analyze the determinants of real estate and credit bubbles using a unique dataset on mortgage loans in Spain. The dataset contain real estate credit and price conditions (loan principal and spread, and the appraisal and market price) at the mortgage level, matched with borrower characteristics (such as income, labor status and contract) and the lender identity, over the last credit boom and bust.
We find that lending standards are softer in the boom than in the bust. Moreover, despite some adjustment in lending conditions in the good times depending on borrower risk, the results suggest too soft lending standards and excessive risk-taking in the boom. Banks with worse corporate governance problems (rescued cajas) soften even more the lending standards. Finally, we analyze the mechanism by which banks could increase the supply of mortgage loans despite of regulatory restrictions on LTVs. The evidence is consistent with banks encouraging real estate appraisal firms to introduce an upward bias in appraisal prices (29 %), to meet loan-to-value regulatory thresholds (40 % of mortgages are just bunched on these limits), thus building-up the credit and the real estate bubble.
All in all, the results suggest that the credit and housing bubble were partly driven by bank agency problems (Freixas and Rochet 2008) and not simply by behavioral motives (Gennaioli et al. 2012). This has crucial implications for public policy, in particular microprudential and macroprudential policy (Freixas, Laeven and Peydró, forthcoming). First, our results are consistent with the new prudential policy measures on limiting the ex-ante banks' incentives to take on excessive risk-taking. Second, the results show that micro loan level data are crucial to identify-ex-ante on real time-excessive credit supply booms. For example, that borrowers who do not work pay identical loan spreads than workers, or that 40 % of LTVs are bunched in the regulatory limits (while, at the same time, appraisal values are substantially higher than transaction prices).
Open Access This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.

Appendix: Descriptive statistics
See Tables A.1, A.2.  We present mean and standard deviation (in brackets) for quantitative variables and the distribution in percentage for qualitative variables a Variables are in real terms b Commercial bank "Banco de Valencia" is included in this group We present mean and standard deviation (in brackets) for quantitative variables and the distribution in percentage for qualitative variables a Variables are in real terms