SPB Git forge

spb/wp14_uqo

Public
3commits 1branches 1releases
1.5 MBsize
maindefault branch
1 h agolast push
Python 52.4% TeX 47.6%
12.0 KB · 242 lines latex
Raw Blame History
1% ============================================================================2\section{Methodology}3\label{sec:methodology}4% ============================================================================56Our empirical strategy has two parts: a feature-engineering pipeline that turns raw7listings into an analysis-ready design matrix (Sections~\ref{subsec:structural}--%8\ref{subsec:vision}), and a hedonic regression that maps those features to price9(Section~\ref{subsec:econometrics}).1011\subsection{Theoretical Framework}12\label{subsec:theory}1314Following \citet{rosen1974hedonic}, a house is a bundle of $K$ characteristics15$\mathbf{z}=(z_1,\dots,z_K)$, and the market clears through a hedonic price function16$P(\mathbf{z})$ that equates the marginal bid of buyers to the marginal offer of17sellers. A buyer with income $y$ and preferences $U(\mathbf{x},\mathbf{z})$ over a18numéraire good $\mathbf{x}$ and housing attributes chooses $\mathbf{z}$ to solve19%20\begin{equation}21  \max_{\mathbf{x},\,\mathbf{z}}\; U(\mathbf{x},\mathbf{z})22  \quad\text{s.t.}\quad y = \mathbf{x} + P(\mathbf{z}),23  \label{eq:consumer}24\end{equation}25%26which yields the first-order condition that, at the optimum, the implicit27(\emph{marginal}) price of each attribute equals the buyer's marginal willingness to28pay:29%30\begin{equation}31  p_k(\mathbf{z}) \;\equiv\; \frac{\partial P(\mathbf{z})}{\partial z_k}32  \;=\; \frac{\partial U/\partial z_k}{\partial U/\partial x},33  \qquad k = 1,\dots,K.34  \label{eq:implicit}35\end{equation}36%37Equation~\eqref{eq:implicit} is the object of interest: the slope of the hedonic38surface in the direction of attribute~$z_k$. The empirical task is to recover39$P(\mathbf{z})$---and hence its gradient---from observed prices and characteristics.40The linear model of Section~\ref{subsec:econometrics} imposes a parametric form on41$P(\cdot)$ and reads the implicit prices off its coefficients; the machine-learning42estimators of Section~\ref{sec:benchmark} approximate $P(\cdot)$ nonparametrically,43trading the closed-form gradient for predictive flexibility.4445\subsection{Structural and Locational Attributes}46\label{subsec:structural}4748Structural attributes are extracted by deterministic rules. Living area and lot area49are reported in heterogeneous units (\texttt{"1535 sqft"}, \texttt{"1,333.2 ft²"},50\texttt{"11 561.52 ft²"}, \texttt{"961.6 m2"}); we parse each string and convert all51areas to square feet. For Realtor.ca listings that report room-by-room dimensions52(e.g.\ \texttt{"23 ft ,4 in x 13 ft ,8 in"}) but no aggregate living area, we sum the53parsed room areas and calibrate the total against listings where both are observed;54the median ratio of reported area to summed-room area is~0.98, so the reconstructed55value is used directly to fill missing living area. Age is computed as56$2026-\text{year built}$, entered together with its square to allow a non-monotone57depreciation profile. Bedrooms, bathrooms, parking spaces, and storeys are taken58from the attribute block. Missing values are imputed by the within-property-type59median, and each imputed field is accompanied by a ``\texttt{has\_}'' indicator so60that the regression can distinguish observed from imputed values.6162Location is captured by \textbf{municipality fixed effects}. City names are63normalized (Realtor.ca appends neighborhood qualifiers in parentheses, which we64strip), and municipalities with fewer than 20 listings are pooled into a residual65category, leaving 195 city effects. Property-type fixed effects and a source66indicator complete the locational and platform controls.6768\subsection{Rule-Based Amenities and Room Detail}69\label{subsec:amenities}7071Seventeen amenity indicators are detected by bilingual (French/English) keyword72matching over the concatenated feature list, description, and title: swimming pool,73waterfront, garage, fireplace, central air conditioning or heat pump, finished74basement, cul-de-sac, proximity to a golf course, ski hill, park, school, highway,75and public transit, among others. From the Realtor.ca room block we additionally76construct room-detail indicators---presence of a primary bedroom, a basement, an77office, a family room, a workshop, a wine cellar, a sunroom, a mezzanine, a library,78and a laundry room---together with the room and storey counts. Two listing-quality79signals, the number of photographs (capped at~60) and the presence of a virtual80tour, proxy for the marketing tier of the listing.8182\subsection{Language-Model Specifications from Text}83\label{subsec:llm}8485Free-text descriptions contain valuation-relevant information that resists keyword86extraction: whether the home is turnkey or a fixer-upper, whether the kitchen or87bathroom has been renovated, the flooring and countertop materials, the heating88system, the presence of a water view, and income potential. We extract these as a89fixed set of structured specifications using a large language model90(\texttt{gpt-4o-mini}) with \emph{schema-constrained decoding}: the request specifies91a strict JSON schema with closed enumerations and required fields, so the API92validates the output at generation time and the model returns exactly the expected93fields in the expected value domains. Decoding temperature is set to zero for94determinism, and the system instruction constrains the model to report only what the95text supports, coding absent information as \texttt{false}/\texttt{unknown}/empty.96Each call consumes roughly 600 input and 110 output tokens; the extraction is run in97parallel, is resumable through an on-disk cache keyed by the listing identifier, and98retries transient errors with exponential backoff, for a total cost of about \$399across the sample.100101\subsection{Vision Attributes from the Façade Photograph}102\label{subsec:vision}103104To capture the visual quality that neither structured fields nor text convey, we105analyze one photograph per listing---the façade---with a vision--language model106(\texttt{claude-haiku-4-5}). For Realtor.ca the first image is the exterior shot; for107DuProprio, whose images are captioned, we select the image whose caption is the108address rather than a room. The model returns twelve objective attributes under a109strict JSON schema: an overall condition score (1--10), a curb-appeal score (1--10),110a renovation level, exterior materials, landscaping quality, visible garage, storeys,111setting (urban/suburban/rural/waterfront/wooded), a luxury indicator, and photo112quality. The system instruction directs the model to ground each score in concrete,113reproducible criteria (surface condition, materials, landscaping) rather than114subjective taste, and to flag non-exterior images. Images are passed by URL without115local download; each call consumes roughly 2{,}470 input and 100 output tokens, for a116total cost of about \$57 across the sample. As with the text layer, the pass is117parallelized, resumable, and retried.118119\paragraph{Why schema-constrained decoding matters.}120Imposing a typed schema with enumerations, required fields, and121\texttt{additionalProperties:false} moves validation into the API layer. The models122are forced to emit exactly the expected fields within the expected value domains, so123their outputs behave as ordinary tabulated variables---reproducible and free of124free-text post-processing. The outputs are then mapped to numeric regressors:125booleans to $0/1$, the ordinal condition scale to $0$--$5$, materials to indicator126variables, and so on, each with an availability flag.127128\subsection{Econometric Specification}129\label{subsec:econometrics}130131We adopt a semi-logarithmic functional form, the standard workhorse in the hedonic132literature \citep{malpezzi2003hedonic}. Collect the attributes of listing~$i$ into133disjoint blocks,134%135\begin{equation}136  \resizebox{.94\textwidth}{!}{$\displaystyle137  \mathbf{X}_i =138  \big(\underbrace{\ln\text{Area}_i,\ \ln\text{Lot}_i}_{\text{size (logged)}},\139  \underbrace{\mathbf{s}_i}_{\text{structural}},\140  \underbrace{\mathbf{a}_i}_{\text{amenities}},\141  \underbrace{\mathbf{r}_i}_{\text{rooms}},\142  \underbrace{\mathbf{m}_i}_{\text{listing}},\143  \underbrace{\mathbf{g}_i}_{\text{LLM text}},\144  \underbrace{\mathbf{v}_i}_{\text{vision}}\big)145  $}146  \label{eq:blocks}147\end{equation}148%149and estimate, by ordinary least squares,150%151\begin{equation}152  \ln P_i \;=\; \alpha153  \;+\; \beta\,\ln\text{Area}_i154  \;+\; \gamma\,\ln\text{Lot}_i155  \;+\; \mathbf{X}_i^{\!\top}\bm{\delta}156  \;+\; \underbrace{\mu_{c(i)}}_{\text{city FE}}157  \;+\; \underbrace{\tau_{t(i)}}_{\text{type FE}}158  \;+\; \varepsilon_i ,159  \label{eq:hedonic}160\end{equation}161%162where $c(i)$ and $t(i)$ index the municipality and property type of listing~$i$, and163$\mu_c$, $\tau_t$ are the corresponding fixed effects that sweep out164location- and type-specific price levels. In matrix form165$\mathbf{y}=\mathbf{Z}\bm{\theta}+\bm{\varepsilon}$ with166$\widehat{\bm{\theta}}=(\mathbf{Z}^{\!\top}\mathbf{Z})^{-1}\mathbf{Z}^{\!\top}\mathbf{y}$.167168\paragraph{Interpretation of the coefficients.}169Because the size variables enter in logs, $\beta$ and $\gamma$ are \emph{elasticities}:170$\partial \ln P/\partial \ln\text{Area}=\beta$. For an indicator regressor $d$ with171coefficient $b$, the exact percentage price effect is not $b$ but172%173\begin{equation}174  \%\Delta P \;=\; \big(e^{\,b}-1\big)\times 100,175  \label{eq:halvorsen}176\end{equation}177%178the \citet{halvorsen1980interpretation} correction we apply throughout (for small179$b$, $e^{b}-1\approx b$). Under Equation~\eqref{eq:hedonic} the implicit price of a180continuous attribute $z_k$ from \eqref{eq:implicit} is $p_k=\delta_k\,P/z_k$, so the181semi-log form lets the \emph{dollar} marginal price scale with the price level while182keeping the \emph{percentage} effect constant.183184\paragraph{Two-part coverage design.}185Because living area is reported for only about 38\% of Realtor.ca listings, we186estimate two nested versions of \eqref{eq:hedonic} and combine their predictions:187%188\begin{equation}189  \widehat{\ln P}_i =190  \begin{cases}191    \widehat{\ln P}_i^{\,A} & \text{if area is measured (Model A, rich),}\\[2pt]192    \widehat{\ln P}_i^{\,B} & \text{otherwise (Model B, broad; }\beta\equiv 0).193  \end{cases}194  \label{eq:twopart}195\end{equation}196%197Model~A includes $\ln\text{Area}$ and is fit on the measured-area subsample; Model~B198drops it and is fit on the full cleaned sample, so every listing can be priced.199200\paragraph{Inference.}201House-price residuals are strongly heteroskedastic, and listings within a202municipality share unobserved local shocks that induce within-cluster error203correlation. Our preferred standard errors are therefore clustered at the204municipality level (195 clusters), the same level as the fixed effects205\citep{cameron2015cluster}:206%207\begin{equation}208  \widehat{\mathrm{Var}}_{\text{CL}}(\widehat{\bm{\theta}})209  = (\mathbf{Z}^{\!\top}\mathbf{Z})^{-1}210    \Bigg(\sum_{c=1}^{C}211    \mathbf{Z}_c^{\!\top}\hat{\bm{\varepsilon}}_c212    \hat{\bm{\varepsilon}}_c^{\!\top}\mathbf{Z}_c\Bigg)213    (\mathbf{Z}^{\!\top}\mathbf{Z})^{-1},214  \label{eq:cluster}215\end{equation}216%217where $\mathbf{Z}_c$ and $\hat{\bm{\varepsilon}}_c$ stack the regressors and218residuals of cluster $c$. As a complement we also compute219heteroskedasticity-consistent (HC3) standard errors220\citep{white1980heteroskedasticity,mackinnon1985some}, which inflate the221contribution of high-leverage points; Section~\ref{subsec:robust} shows that the two222choices agree on the significance of the property-level AI attributes and differ223only for keyword amenities with a strong spatial component.224225\paragraph{Retransformation.}226Predicting the \emph{level} of price requires undoing the log. Because227$\mathbb{E}[P\mid\mathbf{Z}]=\exp(\mathbf{Z}\bm{\theta})\,\mathbb{E}[e^{\varepsilon}]228\neq \exp(\mathbf{Z}\bm{\theta})$, naive exponentiation is biased downward. Under229$\varepsilon\sim\mathcal N(0,\sigma^2)$ we use the closed-form correction, and more230generally Duan's nonparametric smearing estimate \citep{duan1983smearing}:231%232\begin{equation}233  \widehat{P}_i234  = \exp\!\big(\widehat{\ln P}_i\big)\cdot235  \underbrace{\exp\!\big(\tfrac12\hat\sigma^{2}\big)}_{\text{normal}}236  \qquad\text{or}\qquad237  \widehat{P}_i238  = \exp\!\big(\widehat{\ln P}_i\big)\cdot239  \underbrace{\frac1n\sum_{j=1}^{n} e^{\hat\varepsilon_j}}_{\text{smearing }\hat\phi}.240  \label{eq:smearing}241\end{equation}242