
\chapter{Differentiating and Predicting Social and Emotional Loneliness in Students Using Passive Sensing: An Exploratory Study}
\markboth{6. Social and Emotional Loneliness Detection}{}

\section{Overview}
Previous chapters have explored multiple aspects related to loneliness, including its behavioural manifestations and detection techniques. While loneliness is often viewed as a single emotional experience, it is far more complex \cite{weiss1975loneliness}. In this chapter, we will explore its multifaceted nature, mainly by examining the distinction and overlap between social and emotional loneliness. The social dimension of loneliness refers to the subjective experience of feeling socially disconnected and lacking a sense of belonging \cite{russell1984social}. This is commonly seen when individuals have fewer personal relationships or a smaller social circle than they would want. On the other hand, the emotional element emphasizes the lack of a deep, personal level connection with others, which could be deeply experienced even in the physical presence of others \cite{vaux1988social}. The UCLA scale has been used by researchers to investigate the interconnected aspects of social and emotional loneliness \cite{hawkley2005can,cacioppo2006loneliness}. Studies have indicated that experiences of social and emotional loneliness do not always coincide. For instance, a person might have a robust peer network yet miss having a close friend, which indicates they feel emotional loneliness without necessarily feeling socially isolated \cite{maes2017intimate,qualter2002separateness}. This distinction is critical for a nuanced understanding of loneliness, as social and emotional loneliness may arise from different circumstances, have distinct physiological and psychological effects, and therefore may require different intervention strategies \cite{lasgaard2011different}. Specifically, emotional loneliness has been linked with emotional challenges, including negative self-views, introverted behaviour, and distorted views of relationships \cite{rokach2019psychological}. While prior research has identified these distinct types, to the best of our knowledge, no study has investigated how they manifest in behavioural patterns derived from passive sensing data within the student population specifically.

This chapter aims to investigate social and emotional loneliness using passive sensing data for a student population. Our goal is to determine the subtle differences in data from individuals who are socially and emotionally lonely, evaluate the predictive power of behavioural features in categorizing these loneliness types, and find the behavioural features that are most important for differentiating between these two types of loneliness. The key research questions are:

\begin{enumerate}
  \item Can behavioural features extracted through passive sensing data differentiate between socially and emotionally lonely students?
  \item What is the power of behavioural features to classify social and emotional loneliness?
  \item What behavioural features are most important for predictive models in classifying loneliness and its types?
\end{enumerate}

\section{Methods}

\subsection{Categorizing Social and Emotional Loneliness}
We have used the GLOBEM dataset for this study. In the dataset, loneliness was assessed using the revised 10-item UCLA Loneliness Scale \cite{knight1988some}. The revised 10-item UCLA Loneliness Scale uses a 4-point response scale for each item, where 1 represents \textquotesingle never\textquotesingle, 2 \textquotesingle rarely\textquotesingle, 3 \textquotesingle sometimes\textquotesingle, and 4 \textquotesingle often\textquotesingle. With 10 items in total, the minimum possible score is 10 (if a participant responds with 1 for all 10 items), and the maximum possible score is 40 (if a participant responds with 4 for all 10 items). Therefore, the overall score range for this 10-item questionnaire spans from 10 to 40. For our research purposes, we divided the items of scale into two distinct categories of social and emotional loneliness based on the criteria proposed in \cite{maes2022not,borges2008validacion}. Items in the scale that are related to feeling isolated, feeling left out, lack of companionship, and social interactions are classified under the social loneliness category, while the items related to emotional disconnect, like not feeling close to others, and no one truly understanding me, are put under the emotional loneliness category. Each category consisted of 5 items from the original scale presented in Table \ref{tab:UCLADivision}. Some items in the scale, denoted by (R), are reverse-scored. This means that for these items, the scoring is inverted: a response of 1 is scored as 4, 2 as 3, 3 as 2, and 4 as 1. This reverse scoring ensures that higher scores consistently indicate greater levels of loneliness across all items.

\begin{table*}[!t]
    \centering
     \caption{Division of 10-item UCLA scale into Emotional and Social Loneliness, 'R' indicates reverse scoring}
     \renewcommand{\arraystretch}{1.5}
    \begin{tabularx}{\textwidth}{|c|X|}
        \hline
        \textbf{Type} & \textbf{Questions} \\
        \hline
        Emotional Loneliness & 
        1. How often do you feel that no one really knows you well? \\
        & 2. How often do you feel close to other people? (R) \\
        & 3. How often do you feel that there are people who really understand you? (R) \\
        & 4. How often do you feel that there are people you can turn to? (R) \\
        & 5. How often do you feel that people are around you but not with you? \\
        \hline
        Social Loneliness & 
        1. How often do you feel that you have a lot in common with the people around you? (R) \\
        & 2. How often do you feel that you feel left out? \\
        & 3. How often do you feel isolated from others? \\
        & 4. How often do you feel that there are people you can talk to? (R) \\
        & 5. How often do you feel that you lack companionship? \\
        \hline
    \end{tabularx}
    \label{tab:UCLADivision}
\end{table*}

There is no single universally accepted threshold in the literature for determining loneliness cutoff scores for dividing into low or high loneliness categories. Many studies have proposed their own cutoff scores like one by Cacioppo et al. \cite{cacioppo2008loneliness}. In our study, participants were scored on two dimensions: social loneliness (referred to as social\_score) and emotional loneliness (referred to as emotional\_score), each ranging from 5 to 20. A cumulative score of 10 is achieved if a participant selected \textquotesingle rarely\textquotesingle \space for all 5 questions, which represents occasional feelings of social or emotional loneliness. Hence, we chose 10 as our cutoff score for each subscale. To categorize loneliness levels, we used the following approach:

\begin{itemize}
    \item Participants with a social\_score of above 10 and an emotional\_score of 10 and below were labeled as \textquotesingle socially lonely\textquotesingle.
    \item Participants with an emotional\_score of above 10 and social\_score of 10 and below were labeled as \textquotesingle emotionally lonely\textquotesingle.
    \item Participants scoring above 10 on both scales were considered \textquotesingle both socially and emotionally lonely\textquotesingle.
    \item Finally, those scoring 10 or below on both scales were categorized as \textquotesingle not lonely\textquotesingle.
\end{itemize}

We first applied some basic statistics to analyze the different aspects of loneliness among the students in the dataset. This involved calculating the mean, median, first quartile (Q1), third quartile (Q3), and standard deviation (SD) for the four distinct categories: \textquotesingle socially lonely\textquotesingle, \textquotesingle emotionally lonely\textquotesingle, \textquotesingle both socially and emotionally lonely\textquotesingle, and \textquotesingle not lonely\textquotesingle. This provided an initial overview of the overall distribution and central tendency of loneliness within the dataset.

\begin{comment}

\subsection{Dataset and Data Preprocessing}
We have used GLOBEM dataset for this study. All the details about this dataset have been provided in Chapter 3 already, here we will just briefly recap it and present details that are relevant to this chapter. The dataset has been collected in a US university for 10 weeks. It consists of data from 218 undergraduate students. Sensing modalities include location, phone usage, Bluetooth, Wi-Fi, call logs, steps, and sleep, collected via the AWARE app and Fitbit trackers. Loneliness was assessed using the revised 10-item UCLA Loneliness Scale which was used pre and post study \cite{knight1988some}. Given the four response options for each item, the overall score range for this 10-item questionnaire can range from 10 to 40. We included 205 students who completed the post-study loneliness survey.

For our research purposes, we divided the items of scale into two distinct categories of social and emotional loneliness based on the criteria proposed in \cite{maes2022not,borges2008validacion}. Items in the scale that are related to feeling isolated, feeling left out, lack of companionship, and social interactions are classified under the social loneliness category, while the items related to emotional disconnect, like not feeling close to others, and no one truly understanding me, are put under the emotional loneliness category. Each category consisted of 5 items from the original scale, shown in the table \ref{tab:UCLADivision}.

There is no single universally accepted threshold in the literature for determining loneliness cutoff scores for dividing into low or high loneliness categories. Many studies have proposed their own cuttoff scores like one by Cacioppo et. al. \cite{cacioppo2008loneliness}. In our study, participants were scored on two dimensions: social loneliness (referred to as social\_score) and emotional loneliness (referred to as emotional\_score), each one ranging from 5 to 20. To establish these dimensions, we considered the potential answers to the questionnaire: 1 denoting "never," 2 as "rarely," 3 for "sometimes," and 4 for "often." A cumulative score of 10, achieved if a participant selected "rarely" for all 5 questions, which represents occasional feelings of social or emotional loneliness. Hence, we chose this as our cutoff score: scores at or below 10 reflected minimal to no feelings of loneliness, and scores above 10 reflects moderate to high levels of loneliness. To categorize loneliness levels, we used the following approach:

\begin{itemize}
    \item Participants with a social\_score above 10 and an emotional\_score of 10 or less were labeled as "socially lonely."
    \item Those with a social\_score of 10 or less and an emotional\_score above 10 were labeled "emotionally lonely."
    \item Participants scoring above 10 on both scales were considered "both socially and emotionally lonely."
    \item Finally, those scoring 10 or below on both scales were categorized as "not lonely."
\end{itemize}

\end{comment}



\subsection{Differentiating Social and Emotional Loneliness}
We conducted a statistical analysis using behavioural features to address our first research question about differentiating between social and emotional loneliness. Before applying statistical analysis, we used Mutual Information (MI) for feature selection to identify the most relevant behavioural features for differentiating between social and emotional loneliness. We selected features whose cumulative MI reached a threshold of 95\% of the total MI across all features. 

We then checked the normality of the distribution of behavioural features for both socially and emotionally lonely student groups. This was conducted using the Shapiro-Wilk test \cite{royston1983some}, which is a robust method for testing normality in data and it is particularly effective for small sample sizes like ours (24 participants in the socially lonely group and 19 in the emotionally lonely group). The normality check is important because different statistical tests are suitable for different types of data distributions. Parametric tests, such as t-tests or ANOVA, assume that the data follows a normal distribution. If this assumption is violated, non-parametric tests like the Mann-Whitney U test, are more appropriate as they do not rely on the normality assumption. By using the Shapiro-Wilk test, we ensured the validity and reliability of our subsequent statistical analyses in identifying differences between socially and emotionally lonely groups.

Given that the Shapiro-Wilk test indicated a non-normal distribution for majority features, we used a two-sided Mann–Whitney U test to compare the feature distributions between the socially and emotionally lonely groups. This non-parametric test was selected for its ability to compare differences between two independent samples without the assumption of normal distribution. The goal was to determine if there were statistically significant differences in the feature profiles between socially lonely and emotionally lonely groups. The null hypothesis for this test was that there was no difference in the mean of features between the two groups, while the alternative hypothesis stated that the mean of one or more features would differ.

To quantify the magnitude of the differences observed between the socially and emotionally lonely groups, we calculated effect sizes using the statistical technique called bootstrapping. Bootstrapping is a resampling technique that enhances the reliability of statistical inferences, which is particularly useful when working with smaller sample sizes. This method works by repeatedly sampling with replacement from the original dataset to create multiple simulated datasets. This helps for the estimation of sampling distributions and the calculation of robust statistics. In our case, a total of 10K bootstrap samples were used to estimate the distribution of the effect size and resampled features with replacement, which provides a more robust measure in the context of our small sample sizes. This involved resampling the observations (with replacement) 10K times to create multiple bootstrap samples. We selected Cohen's $d$ as our effect size metric. Cohen's $d$ is a standardized measure of the difference between two group means, that is expressed in units of standard deviations. This standardization is used for meaningful comparisons across different variables with varying scales which makes it suitable for our analysis of diverse features. Alongside the point estimate, a 95\% confidence interval was computed from the bootstrap distribution to calculate the precision of the effect size.

\subsection{Predictive Modeling for Loneliness Classification}
We trained multiple ML multi-class classification algorithms to address our second research question regarding the power of behavioural features in classifying loneliness types. The dataset has instances labeled as \textquotesingle socially lonely\textquotesingle, \textquotesingle emotionally lonely\textquotesingle, \textquotesingle both lonely\textquotesingle, or \textquotesingle not lonely\textquotesingle. As we explained in Chapter 3 as well, we selected four widely used machine learning algorithms for our classification task: Support Vector Machine (SVM), XGBoost, Random Forest, and K-Nearest Neighbors (KNN). 

We used nested cross-validation for model evaluation and selection. In the outer loop, we used leave-one-subject-out cross-validation to assess generalization. Within each iteration of the outer loop, we used an inner loop of stratified three-fold cross-validation for hyperparameter tuning using GridSearchCV. Preprocessing steps were conducted within each inner fold before model training and evaluation, including feature scaling, handling missing values, feature selection using MI, and handling class imbalance with SMOTE. We used the macro-averaged F1 score as the evaluation metric for model selection in cross-validation.

For baseline comparisons, we considered the majority class, random weighted classifier, and decision tree models trained on the original, imbalanced dataset to provide a fair comparison. The majority class model always predicts the most frequent class in the dataset to serve as a naive baseline. The random weighted classifier makes predictions randomly. The decision tree model makes classifications based on a series of feature-based questions to serve as a middle-ground comparison between the simplest baselines and our more complex models. These baselines serve as reference points to evaluate the performance of more complex models. The primary metrics for assessing the performance of each model were accuracy, precision, sensitivity, and F1 score. These metrics were calculated for each loneliness category which provide a detailed view of the model's performance. Accuracy provided a global view of model performance, while precision, sensitivity, and the F1 score provided insights into the model's ability to predict each specific class.

\subsection{Feature Importance Analysis}
To address our third research question regarding determining the most important features used by the predictive models in distinguishing between the different loneliness types, we used the Shapley Additive exPlanations (SHAP) values for XGBoost and Random Forest models \cite{lundberg2020local}. We chose these two models specifically because they provided the best results in our predictive classification task.

SHAP values measure the impact of each feature on the model's output for classification. In our multi-class context, SHAP computes values for each class separately to compute feature importance for each loneliness type. Once the classification models were trained, we used the SHAP library to compute the SHAP values for each feature across all data points. This process outputs a SHAP value for each feature for each prediction and each class, indicating the feature's impact on the model's output for classification. We averaged the absolute SHAP values for each feature within each class to analyze the importance of class-specific features. Averaging the absolute SHAP values helped us to see the overall influence of each feature on the model's predictions to provide a clear and robust measure of feature importance within each class. We then ranked the features based on their average absolute SHAP values within each class to identify the most important behavioural indicators for each loneliness category.

\section{Results}

\subsection{Overview of Loneliness in Participants}
For the specific dimensions of loneliness, the mean social loneliness score was 10.93, with a median of 11 and an interquartile range (Q1: 9, Q3: 13) with a standard deviation of 2.736. Emotional loneliness scores have a mean of 10.71, a median of 11, and the same interquartile range (Q1: 9, Q3: 13), but a slightly higher standard deviation of 2.905. These statistics include all students to capture the full range of social and emotional loneliness within the dataset.

When classifying participants based on their social and emotional loneliness scores, we found a bit larger subset experiencing social loneliness (11.71\%, 24 out of 205) compared to emotional loneliness (9.27\%, 19 out of 205). However, a significant portion (42.44\%, 87 out of 205) reported feeling both socially and emotionally lonely which highlights the interconnectedness of these experiences. 36.59\% (75 out of 205) were classified as feeling neither socially nor emotionally lonely.

%Add p-values
\subsection{Statistical Differences for Social and Emotional Loneliness}

To determine whether behavioural features could differentiate between social and emotional loneliness, we conducted a two-sided Mann-Whitney U test on the non-normally distributed data (as confirmed by the Shapiro-Wilk test). Table~\ref{tab:biomarkers} presents the statistically significant (p < 0.05) features only with mean differences and their effect sizes for socially and emotionally lonely groups. We interpret the magnitude of effect sizes (Cohen's d) using the commonly used approach, where values of 0.2, 0.5, and 0.8 are considered as thresholds for small, medium, and large effects, respectively \cite{cohen2013statistical}. Below are the key results.

\begin{table}[H]
  \centering
  \resizebox{\textwidth}{!}{%
\caption{Summary of Significant Features for SL and EL Groups Including Mean Differences and Effect Sizes.}
\label{tab:biomarkers}
\begin{tabular}{lcccc}
\toprule
\textbf{Features} & \textbf{SL Group} & \textbf{EL Group} & \textbf{MDiff} & \textbf{Effect Size (Cohen’s d)} \\
\midrule
\multicolumn{5}{c}{\textbf{Location}} \\
\midrule
LogLocationVariance(evening) & 2.301 (1.864, 2.875) & 3.751 (3.284, 4.324) & -1.452 & -0.715 (-0.964, -0.514) \\
NumberOfSignificantPlaces & 1.504 (1.67, 2.53) & 2.167 (1.675, 2.602) & -0.663 & -0.327 (-0.529, -0.264) \\
NumberOfLocationTransitions & 5.463 (4.174, 6.732) & 7.374 (5.638, 9.532) & -1.911 & -0.780 (-0.957, -0.604) \\
NormalizedLocationEntropy & 0.451 (0.403, 0.546) & 0.323 (0.253, 0.350) & 0.128 & 0.640 (0.549, 0.732) \\
\midrule
\multicolumn{5}{c}{\textbf{Phone Usage}} \\
\midrule
SumDuration & 400.204 (384.163, 416.432) & 495.535 (480.862, 510.303) & -95.331 & -0.535 [-0.758, -0.313] \\
CountEpisode & 30.104 (25.562, 35.942) & 40.645 (35.074, 45.521) & -10.541 & -0.647 [-0.855, -0.439] \\
FirstUseAfter & 28.745 [24.389, 33.867] & 45.067 [41.483, 48.965] & -16.322 & -0.578 [-0.739, -0.418] \\
MaxDuration & 7.683 (6.422, 8.955) & 18.073 (17.534, 19.131) & -10.390 & -0.756 [-0.910, -0.603] \\
\midrule
\multicolumn{5}{c}{\textbf{Bluetooth}} \\
\midrule
UniqueDevices & 3.701 (2.485, 4.933) & 5.516 (4.433, 6.597) & -1.815 & -0.238 (-0.302, -0.175) \\
CountScans & 13.231 (11.630, 14.842) & 19.096 (17.751, 20.448) & -5.865 & -0.277 (-0.452, -0.102) \\
\midrule
\multicolumn{5}{c}{\textbf{Steps}} \\
\midrule
MaxSumSteps & 5800.553 (5400.705, 6200.321) & 6300.878 (5900.205, 6700.426) & -500.325 & -0.518 (-0.604, -0.433) \\
AvgSumSteps & 4800.335 (4500.634, 5100.074) & 5300.745 (5000.832, 5600.642) & -500.410 & -0.237 (-0.374, -0.128) \\
\midrule
\multicolumn{5}{c}{\textbf{Sleep}} \\
\midrule
AvgDurationAwake & 60.320 (48.294, 72.041) & 88.385 (78.037, 102.181) & -28.065 & -0.451 (-0.647, -0.255) \\
AvgDurationaSleep & 510.047 (405.378, 610.582) & 407.731 (385.284, 433.539) & 102.316 & 0.404 (0.308, 0.501) \\
\bottomrule
    \end{tabular}
    }
\end{table} 


Our analysis of location-based features found significant differences between socially lonely (SL) and emotionally lonely (EL) groups. The log-transformed location variance in the evening, which represents the variability in a participant's geographic position, was lower for the SL group (M = 2.301) compared to the EL group (M = 3.751), with a medium effect size of -0.715. This indicates that emotionally lonely individuals show more varied movement patterns in the evening. On the daily basis, the SL group visited fewer significant places, defined as distinct locations (M = 1.504), compared to the EL group (M = 2.167). The number of transitions between these significant locations was also lower for the SL group (M = 5.463) than the EL group (M = 7.374), with a large effect size of -0.780, indicating less movement between key locations for socially lonely individuals. Interestingly, the normalized location entropy, which measures the evenness of time distribution across significant locations, was higher for the SL group (M = 0.451) compared to the EL group (M = 0.323). This indicates that while socially lonely individuals visit fewer locations, they tend to distribute their time more evenly across these places.

Analysis of phone usage patterns also found significant differences between the two groups. The EL group showed higher overall phone engagement with a total daily unlock duration of 495.535 minutes compared to 400.204 minutes for the SL group (d = -0.535). The EL group took longer to first use their phone after waking, averaging 45.067 minutes versus 28.745 minutes for the SL group with an effect size of -0.578. Another difference was in the maximum duration of a single unlock episode, with the EL group spending up to 18.073 minutes compared to 7.683 minutes for the SL group. Other metrics, including the frequency of phone unlocks, also showed higher values for the EL group.

Analysis of Bluetooth related patterns also found significant differences between groups. It shows that the EL group encountered more unique devices daily (M = 5.516, 95) compared to the SL group (M = 3.701) which indicates increased social proximity or time spent in populated areas. Step count analysis showed the EL group had higher average daily steps (M = 5300.745) than the SL group (M = 4800.335), with a medium to large effect size (d = -0.754). Sleep patterns differed as well with the SL group sleeping longer on average (M = 510.047 minutes) compared to the EL group (M = 407.731 minutes). However, the EL group spent more time awake in bed (M = 88.385 minutes) than the SL group (M = 60.320 minutes) which might indicate sleep quality issues.

\subsection{Predictive Power of Behavioural Features in Loneliness Categories}

Table~\ref{tab:classificationResults} presents the predictive performance of different ML classifiers for categorizing loneliness into \textquotesingle socially lonely\textquotesingle, \textquotesingle emotionally lonely\textquotesingle, \textquotesingle both lonely\textquotesingle, and \textquotesingle not lonely\textquotesingle. We compared these classifiers against three baseline models: Majority Class (BL1: MC), Decision Tree (BL2: DT), and Random Weighted Classifier (BL3: RWC). These baseline models were chosen because they provide simple, interpretable benchmarks to evaluate the performance of more complex classifiers. 

The XGBoost model achieved the highest overall accuracy of 78.48\%. It outperformed in classifying the \textquotesingle Both Lonely\textquotesingle \space category with an F1-score of 85.44\% and showed strong performance in the \textquotesingle Emotionally Lonely\textquotesingle \space category with an F1-score of 70.49\%. The XGBoost model showed the best overall balance and highest metrics across all classes. After that, the Random Forest model achieved an accuracy of 75.58\%, showing strong performance with an F1-score of 82.41\% for the \textquotesingle Both Lonely\textquotesingle \space class and 72.76\% for the \textquotesingle Not Lonely\textquotesingle class. The model provided a good balance of precision and sensitivity across all categories. Support Vector Machine (SVM) performed well with 70.10\% accuracy and made strong predictions in the \textquotesingle Both Lonely\textquotesingle \space and \textquotesingle Not Lonely\textquotesingle \space categories. K-Nearest Neighbors (KNN) shown balanced performance with a 65.53\% accuracy.

While F1-scores provide a balanced performance measure but investigating precision and sensitivity separately can provide important observations regarding these models. For instance, the XGBoost model showed high precision (88.07\%) in detecting students who are \textquotesingle Both Lonely\textquotesingle, which shows a low false positive rate for this category. However, its sensitivity for \textquotesingle Socially Lonely\textquotesingle \space students was lower (58.59\%), which shows some challenges in identifying all cases in this category. The Random Forest model showed a more balanced precision-sensitivity trade-off for the \textquotesingle Not Lonely\textquotesingle \space category (precision: 75.94\%, sensitivity: 70.86\%) which shows consistent performance in both correctly identifying and capturing instances of this class. These nuances in precision and sensitivity across different loneliness categories highlight the varying challenges in accurately classifying each type of loneliness.

\begin{table}[H]
  \centering
  \resizebox{\textwidth}{!}{%
\caption{Classification Results for Different Models on Loneliness Categories}
\label{tab:classificationResults}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|l|c|ccc|ccc|ccc|ccc|}
\hline
\textbf{Model} & \textbf{Acc} & \multicolumn{3}{c|}{\textbf{Socially Lonely}} & \multicolumn{3}{c|}{\textbf{Emotionally Lonely}} & \multicolumn{3}{c|}{\textbf{Both Lonely}} & \multicolumn{3}{c|}{\textbf{Not Lonely}} \\
\cline{3-14}
 & & \textbf{Prec} & \textbf{Rec} & \textbf{F1} & \textbf{Prec} & \textbf{Sens} & \textbf{F1} & \textbf{Prec} & \textbf{Rec} & \textbf{F1} & \textbf{Prec} & \textbf{Sens} & \textbf{F1} \\
\hline
BL1: MC & 42.54 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 42.54 & 100.00 & 59.59 & 0.00 & 0.00 & 0.00 \\
BL2: DT & 45.49 & 20.45 & 25.87 & 22.84 & 18.38 & 21.44 & 19.18 & 55.46 & 65.32 & 60.50 & 35.20 & 38.39 & 36.54 \\
BL3: RWC & 35.47 & 11.65 & 24.58 & 15.24 & 9.18 & 19.43 & 12.54 & 40.94 & 85.34 & 54.65 & 37.28 & 38.22 & 37.59 \\
SVM & 70.10 & 60.00 & 50.55 & 55.74 & 65.28 & 60.74 & 62.63 & 75.18 & 80.11 & 77.67 & 70.39 & 65.54 & 67.10 \\
RF & 75.58 & 65.43 & 55.74 & 60.54 & 70.15 & 65.24 & 67.08 & 80.84 & 85.72 & 82.41 & 75.94 & 70.86 & 72.76 \\
KNN & 65.53 & 55.11 & 45.69 & 50.64 & 60.48 & 55.00 & 57.06 & 70.15 & 75.75 & 72.38 & 65.57 & 60.92 & 62.14 \\
XGBoost & 78.48 & 68.37 & 58.59 & 63.62 & 68.63 & 73.27 & 70.49 & 88.07 & 83.13 & 85.44 & 73.58 & 78.52 & 75.27 \\
\hline
\bottomrule
    \end{tabular}
    }
\end{table} 

\subsection{Important Features for Loneliness Classification}

\begin{figure*}[htp] \centering{
\includegraphics[width=10cm, height=7cm]{figures/Ch6/XGBoost_SHAP.pdf}
\caption{Mean absolute SHAP values for XGBoost model}
\label{fig:shap_XGBoost}}
\end{figure*}

\begin{figure*}[htp] \centering{
\includegraphics[width=10cm, height=7cm]{figures/Ch6/RandomForest_SHAP.pdf}
\caption{Mean absolute SHAP values for Random Forest model}
\label{fig:shap_randomforest}}
\end{figure*}

Fig.\ref{fig:shap_XGBoost} and Fig.\ref{fig:shap_randomforest} present the mean absolute SHAP values for different features across the four loneliness categories: Socially Lonely (SL), Emotionally Lonely (EL), Both Lonely (BL), and Not Lonely (NL). The x-axis represents the normalised mean absolute SHAP value for each feature, which shows the average magnitude of that feature's contribution to the model's output. SHAP values represent the impact of a feature on the model's prediction. The magnitude of a SHAP value shows the feature's importance for a particular prediction. In our figures, larger mean absolute SHAP values indicates a stronger average influence of that feature on the model's decisions. 

Both XGBoost and Random Forest models identified location-based and phone usage features as highly influential in distinguishing between loneliness categories. However, there were some differences in the relative importance of specific features between the two models. The most influential features in the XGBoost model were the maximum duration of phone usage and location maximum length of stay at clusters. These features showed a strong impact across all loneliness categories but the strongest effect was on the \textquotesingle Both Lonely\textquotesingle \space category. Sleep-related features such as average duration awake also showed some importance specifically for the \textquotesingle Not Lonely\textquotesingle \space category.

In our Random Forest model, the SHAP value analysis also found important findings related to features. Location-based features such as variance and entropy were highly influential and had the greatest impact on almost all categories. The maximum duration of the phone and location entropy were also influential. Interestingly, Bluetooth-related features appeared more important in the Random Forest model as compared to XGBoost.

\section{Discussion}
The main aim of this chapter was to explore how behavioural features from passive sensing data could distinguish between social and emotional loneliness and classify loneliness types using machine learning models. The analysis found statistically significant differences in the behavioural markers for social and emotional loneliness groups. The observed differences in behavioural features between the Socially Lonely (SL) and Emotionally Lonely (EL) groups provide evidence that passive sensing can capture distinct patterns associated with these two forms of loneliness.

Location-based behaviours showed significant differences between the two groups. The EL group showed higher location variance, especially in the evening, visited more significant places, and had more location transitions compared to the SL group. In contrast, the SL group's lower mobility and fewer significant places visited may indicate a lack of interest or opportunity to participate in social interactions, which is a sign of social loneliness \cite{reis2021gender}. This behaviour might be linked to the Introversion-Extraversion Dimension of personality. Socially lonely individuals may lean towards introversion who prefer solitary activities and less social stimulation \cite{burger1995individual}. There could also be some other factors for this behaviour, like a lack of social support, which might discourage them from exploring new environments or engaging in social activities. Interestingly, while the SL group visited fewer locations, they showed higher location entropy, which indicates more evenly distributed time across the places they visited. This might indicate a preference for familiar or comfortable environments, maybe somehow to manage feelings of social disconnection. This difference between the two groups shows the nuanced ways in which loneliness manifests. However, it is important to note that the current data cannot definitively establish a causal relationship. Existing studies provide some information about the reasons behind loneliness related behaviours \cite{diehl2018loneliness, labrague2021social, martin2021effect,hemberg2022loneliness}. However a deeper investigation is still needed while using different methods like combining qualitative methods with behavioural features to gain a more nuanced understanding of the complex relationship between these two loneliness types and daily life behaviours.

The findings on phone usage patterns also show differences between the two types of loneliness. The EL group uses their phones more often and for longer periods, which might mean they prefer digital communication instead of face-to-face interactions. This could be explained by the idea of displacement hypothesis, where increased digital engagement takes the place of in-person social interactions and it could lead to increased feelings of isolation or loneliness \cite{valkenburg2007online}. The SL group uses their phones less, maybe because they have a different social situation or don't feel the need for digital contact.

The Bluetooth data shows more unique device encounters for the EL group, which supports the location data in suggesting that emotionally lonely individuals might seek out more populated areas. According to existing research, this behaviour aligns with the emotional loneliness construct, where individuals might feel lonely despite being in social settings \cite{weiss1975loneliness}. Significant differences in physical activity and sleep patterns between the two groups provide additional information about the behavioural impacts of loneliness. The SL group is less physically active which might cause or be a result of them withdrawing socially. They also sleep more, which could be due to many reasons like if they are feeling depressed or not active during the day, leading to a need for less sleep at night.

These findings have important implications for understanding the complex nature of loneliness and its impact on student behaviour and well-being. These findings show that passive sensing can differentiate between social and emotional loneliness and find the behavioural patterns associated with each. These findings can be used for targeted interventions, such as promoting social engagement for socially lonely students or addressing emotional needs and connectivity for emotionally lonely students. To maximize the effectiveness of such interventions, it is important to first get a deeper understanding of the motivations and experiences behind the behavioural differences we observed. More qualitative research with behaviour understanding could help us to understand why individuals engage in specific patterns and how they perceive the connection between their behaviours and feelings of loneliness.

The machine learning models trained for classification based on loneliness types showed their predictive capabilities of behavioural features extracted through passive sensing data. The best-performing model was XGBoost with an overall accuracy of 78.48\%. This highlights the power of ensemble-based techniques for handling complex sensor datasets for loneliness prediction. Moreover the F1 score for XGBoost is also high for the \textquotesingle Both Lonely\textquotesingle \space category as compared to other models. This shows the overall robustness of XGBoost for the classification of social and emotional loneliness.

The varying precision and sensitivity scores across different models and loneliness categories highlight important observations about the challenges of classifying loneliness types based on behavioural data. For instance, XGBoost's high precision (88.07\%) for the \textquotesingle Both Lonely\textquotesingle \space category indicates that when the model predicts this category, it's highly likely to be correct. This indicates that students experiencing both social and emotional loneliness may exhibit more distinct behavioural patterns that are easier for the model to identify. On the other hand, the lower sensitivity for the \textquotesingle Socially Lonely\textquotesingle \space category across models indicates that behaviours associated with social loneliness might be more subtle or varied, making it challenging for models to identify all instances. This could imply that social loneliness manifests in more diverse ways in behaviours and might overlap with patterns seen in other loneliness categories, which makes it difficult for models to identify it correctly.

The feature importance analysis for XGBoost and Random Forest models provides important findings about the behavioural features that distinguish between different loneliness categories. The consistent importance of location-based and phone usage features across both models highlights their significance in understanding and categorizing loneliness. This indicates that mobility patterns play a significant role in differentiating loneliness types. Interestingly, our analysis found lower SHAP scores for features distinguishing between SL and EL groups compared to those differentiating the \textquotesingle Both Lonely\textquotesingle \space and \textquotesingle Not Lonely\textquotesingle \space categories. There could be multiple potential reasons for this observation. SL and EL might share similar behavioural patterns in some aspects which made it challenging for the models to distinguish between them based solely on passive sensing data. This means the behavioural manifestations of social versus emotional loneliness might be more nuanced and less pronounced in passive sensing data compared to the clear differences between being lonely (in any form) and not lonely. This could be because students experiencing both types of loneliness have shown more clear or consistent behaviours. At the same time, those who are not lonely have significant different patterns of movement, phone usage, and sleep.


\subsection{Comparison with Chapter 5 Results}
Chapter 5 and this chapter used the same GLOBEM dataset but in different contexts. Chapter 5 generic models were trained for binary classification with incremental learning while here we trained for multi-class classification using all the data at once. Comparing results from both chapters provides important observations about the complexities of loneliness detection using passive sensing data. 

The XGBoost model consistently outperformed other algorithms in both chapters with an accuracy of 76.52\% in Chapter 5 and 78.48\% in this chapter. However, other metrics such as precision and sensitivity were lower in Chapter 5 for detecting lonely classes as compared to this chapter, \textquotesingle both lonely\textquotesingle \space class. This could be due to inherent challenges with the incremental learning approach and benefits of batch learning in this chapter.

Both chapters showed strong performance in classifying general lonely vs not lonely which shows that passive sensing data can effectively capture overall loneliness states in behaviours. However, the multi-class model's lower performance in distinguishing between the SL and EL categories shows that these specific types of loneliness may have more subtle or overlapping behavioural manifestations which made it hard for the models to capture and learn effectively in the small sample. This also highlights the complexity of loneliness as a psychological construct and the challenges in its fine-grained classification based solely on behavioural data.

\section{Conclusions and Limitations}
In this chapter, we have explored the multifaceted nature of loneliness among students, specifically focusing on the distinction between social and emotional loneliness using passive sensing data. Our research has addressed three key questions that provide important insights into the behavioural manifestations of different types of loneliness. The main takeaways from this chapter are:

\begin{itemize}
\item Firstly, our analysis found that behavioural features extracted through passive sensing data can differentiate between socially and emotionally lonely students. The statistical test found statistically significant differences in various behavioural features between these two groups. Socially lonely individuals showed less variance in their locations as compared to emotionally lonely individuals. Additionally, socially lonely students had shorter overall phone usage duration, fewer Bluetooth scans, and fewer steps than emotionally lonely students.
\item Our study has shown the considerable predictive power of behavioural features in classifying social and emotional loneliness. The XGBoost model achieved the highest overall accuracy of 78.48\% and a high F1 score across all loneliness categories. This shows the potential of behavioural features extracted through passive sensing in identifying and differentiating between types of loneliness.
\item We identified the most important behavioural features for predictive models in classifying loneliness and its types. Our analysis identified phone usage and location-based features as critical in distinguishing between loneliness categories in both XGBoost and Random Forest models. The findings highlighted that phone usage duration, location variance, and sleep-related features were particularly significant in differentiating socially, emotionally, and both socially and emotionally lonely individuals from those not experiencing loneliness.
\end{itemize}

Despite these significant findings, our study has some limitations that could be addressed in future research (see Chapter 8 for details):

\begin{itemize}
\item As we discussed in earlier chapters as well, the generalizability of our findings is limited by the size and diversity of the dataset. The participants, who are college students, form a homogeneous group with possibly similar daily routines and psychological challenges.
\item The dataset we used does not capture all the characteristics associated with loneliness. Personal relationships \cite{de1989personal}, age \cite{shovestul2020risk}, major life events \cite{lim2020understanding}, and mental health history \cite{hayes2022exploring} all significantly influence an individual's experience of loneliness.
\end{itemize}



