# Predicting Missing Values in Survey Data Using Prompt Engineering for Addressing Item Non-Response
## 3 Methods
### Problem Definition and Formalization  
Consider a survey dataset \(D\), represented as an \(M\times N\) table where \(M\) and \(N\) represent the number of respondents and the number of questions, respectively. The columns are denoted by \(Q=\{q_{1},\cdots,q_{N}\}\), indicating the question codes for each of the questions, and the rows of \(D\) are denoted by \(R=\{\mathbf{r}_{1},\cdots,\mathbf{r}_{M}\}\), representing the vector of response values for each respondent. Additionally, each \(q_{j}\) has the categorical options \(O_{j}=\{o_{j_{1}},\cdots,o_{j_{1}}\}\), and each response vector \(\mathbf{r}_{i}\) comprises elements \(r_{ik}\), where each \(r_{ik}\) denotes a specific response value within the vector. Note that some values \(r_{ik}\) may be missing (i.e., \(r_{ik}=\text{NaN}\)).  
The survey data include not only the values present in the table but also the actual text data mapped to these values. Specifically, each \(q_{j}\) can be translated into its corresponding survey question text \(t(q_{j})\), and each \(r_{ik}\) can be converted into its corresponding textual response \(t(r_{ik})\), where \(t(\cdot)\) denotes the mapping function from values to text.  
In traditional methods, missing values are filled using a statistical imputation approach for each \(\mathbf{r}_{i}\) or tabular data prediction methods that learn correlations between each column \(q_{j}\). However, these methods fail to consider the linguistic semantics inherent in the survey questions \(t(q_{j})\) and the responses \(t(r_{ij})\), which carry information that is distinct from the correlations or statistical data. In this work, our goal is to predict the missing values \(r_{ij}\) for a specific question \(q_{t_{q}}\) and a specific respondent \(r_{t_{t}t_{q}}\) in the survey dataset \(D\) using linguistic semantic information \(t(q_{j})\) and \(t(r_{ij})\), where \(t_{q}\) is the index of the target question and \(t_{r}\) is the index of the target respondent.  
To leverage the linguistic semantic information present in the survey data \(D\), we can calculate the probability of an answer using the following probability value with the use of a language model:  
\[t(r_{t_{t}t_{q}})\sim P(A)=\prod_{i=0}^{n}P_{LM}(a_{i}\mid a_{0},\ldots,a_{i- 1},t(q_{t_{q}}),t(q_{x}),t(r_{yx})), \tag{1}\]  
where \(A=\{a_{0},\ldots,a_{i}\}\) denotes the set of tokens in the output generated by the LLM. Here, \(x\in X\) and \(y\in Y\) denote elements of the index sets \(X\) and \(Y\), respectively, with \(X\) representing the set of indices excluding \(t_{q}\) and \(Y\) representing the set of indices excluding \(t_{r}\).  
This approach utilizes all linguistic information obtainable from the survey data \(D\) within the LM to generate an accurate response to the target question \(q_{t_{q}}\) and target respondent \(\mathbf{r}_{t_{r}}\). However, this method can lead to increased computational costs and potential performance degradation due to the inclusion of irrelevant information. To address these challenges, we first select appropriate contexts and few-shot examples; then, we apply the \(Prompt(\cdot)\) function based on prompt engineering techniques in LLMs. The correct answer can then be generated using the following probability equation:  
\[t(r_{t_{t}t_{q}})\sim P(A)=\prod_{i=0}^{n}P_{LM}(a_{i}\mid a_{0},\ldots,a_{i- 1},Prompt(t(q_{t_{q}}),t(q_{x_{r}}),t(r_{y_{r}x_{r}}))), \tag{2}\]  
where \(x_{r}\) is an element of \(X_{r}\) and \(y_{r}\) is an element of \(Y_{r}\), with \(X_{r}\) representing the set of indices of questions related to the target question \(q_{t_{q}}\) and \(Y_{r}\) representing the set of indices of respondents related to the target respondent \(\mathbf{r}_{t_{r}}\).