Code & Cure

#26 - How Your Phone Keyboard Signals Your State Of Mind

Vasanth Sarathy & Laura Hagopian

What if your keyboard could reveal your mental health? Emerging research suggests that how you type—not what you type—could signal early signs of depression. By analyzing keystroke patterns like speed, timing, pauses, and autocorrect use, researchers are exploring digital biomarkers that might quietly reflect changes in mood.

In this episode, we break down how this passive tracking compares to traditional screening tools like the PHQ. While questionnaires offer valuable insight, they rely on memory and reflect isolated moments. In contrast, continuous keystroke monitoring captures real-world behaviors—faster typing, more pauses, shorter sessions, and increased autocorrect usage—all patterns linked to mood shifts, especially when anxiety overlaps with depression.

We discuss the practical questions this raises: How do we account for personal baselines and confounding factors like time of day or age? What’s the difference between correlation and causation? And how can we design systems that protect privacy while still offering clinical value?

From privacy-preserving on-device processing to broader behavioral signals like sleep and movement, this conversation explores how digital phenotyping might help detect depression earlier—and more gently. If you're curious about AI in healthcare, behavioral science, or the ethics of digital mental health tools, this episode lays out both the potential and the caution needed.

Reference: 

Effects of mood and aging on keystroke dynamics metadata and their diurnal patterns in a large open-science sample: A BiAffect iOS study
Claudia Vesel et al.
J Am Med Inform Assoc (2020)

Credits: 

Theme music: Nowhere Land, Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0
https://creativecommons.org/licenses/by/4.0/


SPEAKER_01:

Mood leaves a digital footprint and it's hiding in your keystrokes. The question is, what can we do with this insight?

SPEAKER_00:

Hello and welcome to Code and Cure, the podcast where we discuss decoding health in the age of AI. My name is Vasant Sarathi, and I'm an AI researcher and a cognitive scientist, and I'm here with Laura Hagopian. I'm an emergency medicine physician and I work in digital health. Today's topic is very interesting because it's not, you know, our typical or our usual AI being used to solve some healthcare problem or to make something more efficient or anything like that. It's not an LLM and it's not a diffusion model. It's not machine learning. Well, maybe there is a little bit of that, but for the most part, it's not those things. And it's not, you know, some complex medical thing, you know, imaging technique or anything like that or any situation like that. Instead, it's about behavioral health. It's about mood. And the techniques are so simple, but they're so interesting. And so we found this paper that we thought we wanted to share with you all. And um it's all about how typing and your keystrokes can actually be a potential digital biomarker for moods.

SPEAKER_01:

And it's not like exactly what you're typing, it's not the content of what you're typing, right? It's not the message. In this study, they tracked the metadata. So it's like, oh, how fast was someone typing? How many errors did they make? How many, like, how long were their pauses? How long was their typing session in total? So it was all this information that had nothing to do with the message itself that basically can they found contained um a good amount of information about someone's mood.

SPEAKER_00:

That is, I mean, absolutely fascinating to me because I mean, first of all, you know, this is a device that's a modern device, right? It's a phone, it's got specific specific affordances of a phone, and you know, you're typing on a phone and you have a keyboard on there. And to me, it's fascinating that the way your fingers move to convey ideas and messages and so on is a little bit of a hint into what your brain and what your mind is actually doing right now.

SPEAKER_01:

Right? It's it's like it's very cool. And what they did was it it was a sample of people who happened to say, okay, like I'm gonna participate in this and I'm gonna download this keyboard that looks like your typical iOS or in some cases Android keyboard. Yeah. And but it allows tracking of the metadata. So it's gonna look, you know, you could you can go and do it. You can go onto buyfact.com and like say, I I want to download this keyboard so that they can do research on me too.

SPEAKER_00:

Oh, that's cool. I'm yeah, I might do that. That's a good idea. I I think that it's you know, maybe it's worthwhile taking a step back for a second and seeing, okay, we're talking about mood. What is what is mood and in in this in this context and how is it currently being measured?

SPEAKER_01:

Yeah, so I think we can we can talk mostly about sad, sad mood or depressed mood right now, uh, because that's what they were tracking in this study. And from a clinical standpoint, a lot of times we screen for mood disorders and we track mood with a questionnaire called the PHQ. And many people here have probably done the PHQ. You might get it at your checkup. Um, you know, if you have a mood disorder, you might be asked more frequently to do it, you know, every three months, every six months, etc. Um, but it's intermittent, right? And it requires the patient to report things. And, you know, depending on how you feel that day or what time of day it is, you might have different responses. But it asks like, hey, um, how often have you been bothered by these problems? Feeling down or depressed, um, trouble falling or staying asleep, poor appetite or overeating, um, feeling bad about yourself. There's a whole series of questions in this PHQ or patient health questionnaire that's looking at mood. Yeah.

SPEAKER_00:

Yeah.

SPEAKER_01:

And so that's, you know, it's something that you could do electronically. It's something you could do at your doctor's office. But I think the key points are, you know, it takes time to do, right? Yeah. Uh, it's it's active, it's not passive, and it's pretty intermittent. Like you're not gonna do the PHQ every day.

SPEAKER_00:

Yeah, and even even if you do it right before a doctor's visit, it's right before a doctor's visit. There's all this context that you already have about it, and that day might be very specific in many ways, right? You might it might not be representative of the rest of the time you're experiencing those feelings.

SPEAKER_01:

Right. And it does say in the questionnaire, like over the last two weeks, how how often have you been bothered by these symptoms, right? It does ask you to have that recall. But of course, there's there's bias in terms of recall and in terms of what you've been feeling more recently, for example. And so it it's a great tool. It's been well studied, it's validated. Um, but I think the question they were starting to ask in this study was a good one because um when you're using someone's keyboard strokes, it's passive, right?

SPEAKER_00:

They're not even aware that you're doing that, which is actually a good thing in this particular instance because you're it's better than consciously recalling something. You're actually tracking, you're potentially tracking something directly.

SPEAKER_01:

I mean, it could be, right? That's the that's kind of the question that we're we're asking the study, but it's not like obtrusive.

SPEAKER_00:

Yeah.

SPEAKER_01:

It's something that is just happening in the background and it can be happening all the time. So you're not getting a result every three months or six months or year or whatever it is. Like you're able to track the ups and downs over time if there is something going on there, and we're able to find that that type of correlation. Um, the other thing is like, I don't know, this is not, it's not like a super long questionnaire. It's eight or nine questions long, depending on the version that you give. Um, but it takes time to do, it takes energy to do, right? Uh, and so there is this component of like, wouldn't it be nice if our phones could like sense us instead of us having to tell this is how I feel.

SPEAKER_00:

Yeah, I agree.

SPEAKER_01:

I think there's there's definitely this component of it where it makes it easy. Like our phones send so many things about us to begin with. Like if you go to if you go over to someone's house, you start getting retargeted with ads for their toothpaste because you logged into their Wi-Fi, right? Yeah. Like there's so much sensing going on with phones. Like, can we harness some of that?

SPEAKER_00:

I mean, we have heart rate monitors and other things on our phones that are sending information. If you ask me, is my heart racing right now? I might give you a weird answer, but my phone's just my my my my phone, my my watch is is is measuring all of that automatically. It's kind of the same thing, but for moods, right? I mean, that's it's That's the concept, right?

SPEAKER_01:

Yeah of course there could be errors with something like this too. Sure. Right. Um you know, in the physician community, we we joke about Fitbit syndrome. It's it's right after New Year's. Lots of people get their new Fitbits over the holidays, and then they start coming in saying, oh, you know, I got I had this abnormality detected on my Fitbit. I had this abnormal. And sometimes they're real, and sometimes it's you know, yeah, it's meant to detect certain things, it's not so great at detecting other things. So it's you know, we you want to make sure that if you're saying this works, that it truly does work, that it truly does correlate. And that's what they were kind of exploring in this study. So what they looked at was a few different variables. Um, and they they took a sample of people and they said, Hey, we're gonna find out your PHQ depression mood scores.

SPEAKER_00:

This is like a few hundred people, right?

SPEAKER_01:

Yeah, a few couple hundred people. And then we're gonna follow your typing. And it was the metadata from the typing.

SPEAKER_00:

So again, not the actual content of what they were saying, but like the the timing of when a key was pressed and when another key was pressed and so on.

SPEAKER_01:

Yeah. So like if you're spelling out a word, like word, how long does it take you to go from W to O to R to D? Yes. Right. Um, and then if you're pausing, like to think or what whatever, how long is that pause? And what's the sort of variability in there too? Is it fast and then slow and then fast and then slow, or is it kind of more uniform? And then of course, uh I use autocorrect all the time. Like they checked the accuracy, how many autocorrect instances were needed or used.

SPEAKER_00:

Yeah. And I think they they had an autocorrect ratio that was against all the number of characters you typed or something.

SPEAKER_01:

And they tried to correct for other things too, right? Like they said, oh, uh, we notice the the time of day is important. People are better at typing in the middle of the day. Yes. Uh, they get worse at typing at the end of the day. And midnight to 2 a.m. It's like pretty bad.

SPEAKER_00:

Don't send emails after midnight, right? Same sort of thing, yeah.

SPEAKER_01:

Um, and there were variations with age too, right? So, you know, older people were sometimes slower, maybe took longer pauses, et cetera. So they they tried to correct for some of those things. And some people type with one hand versus two hands.

SPEAKER_00:

I mean, there's that too, right?

SPEAKER_01:

And they did some modeling to try to correct for all of those things.

SPEAKER_00:

Yeah.

SPEAKER_01:

Um, and I'm sure that, you know, it's impossible to correct for all the metrics that are out there. But what they were able to find um is that the people with worse mood, like higher PHQ scores, they compare those to the people with PHQ scores of zero, like very good moods.

SPEAKER_00:

Yes. And it's worthwhile to note that this was this study is is a few years old now, and there's been follow-ons. But this original, this was the original study where they had the uh it was more exploratory. So they they they wanted to see, okay, not every single nuance of this of this correlation between um typing speed and mood, but more in terms of uh large-scale effects. So what they did was they focused on PHQ scores of zero versus the worst, right? So the the best mood versus the worst mood in a sense, and try to see Yeah, not the stuff in the middle. Not the stuff in the middle, yeah, because that's all like follow-on nuance, but they wanted to see if there's an effect at this very gross level, right?

SPEAKER_01:

Yeah, and they found that people who were sad, who had a more depressed mood, they actually typed faster.

SPEAKER_00:

Interesting.

SPEAKER_01:

Which we'll get into that.

SPEAKER_00:

Interesting.

SPEAKER_01:

But at the same time, they had more pauses and they had more sort of variability in their typing, fast to slow to fast to slow. Um and and their sessions were shorter. So they typed for like a a shorter amount of time. Interesting. So they typed quickly and for a shorter amount of time. With more variability, with more variability and more pauses, and their typing was less accurate.

SPEAKER_00:

Okay.

SPEAKER_01:

So they used, they ended up using autocorrect a lot more frequently than the people with um, you know, a a good mood.

SPEAKER_00:

Yeah, right. People with zero PHQ score um uh nine scores. Yeah.

SPEAKER_01:

They use the PHQ eight actually, because they they took away the suicidality question. Oh, I see. Okay.

SPEAKER_00:

Um that's fascinating to me. And I want to dig a little deeper into this business of typing faster. Because it seems like that's uh maybe counterintuitive in some level. Um you know, it seems like mood slows people down, but maybe not. Maybe there is a connection between depression and um these sorts of motor skill motor slash thinking skills.

SPEAKER_01:

Yeah, well, so I if you asked me to summarize, like, oh, what is this what does this mean? Like the the longer pauses, the high variability, the fast typing speed, I'd say it means like it it's a little bit more erratic.

SPEAKER_00:

Yeah.

SPEAKER_01:

And that does not actually surprise me because depressive disorders have a bunch of like neurocognitive and psychomotor mechanisms associated with them, right? So you could have motor slowing. That's you know, that makes sense in your head, right? You're gonna slow down a little bit. You're when you're down and when your mood is down. But there's also this like erratic motor control. Um and that includes for things like typing. So it's not it's not surprising to me that the typing speed is altered, but like it's it's the whole picture that makes it feel like, oh, this makes sense to me because there are longer pauses, there's higher variability, there's uh more errors, and the typing speed is is altered too.

SPEAKER_00:

Yeah, yeah.

SPEAKER_01:

And in addition to that, I'm not surprised that there are more errors, right? Because it's erratic. And you know when you have that faster typing, right? Right. And there have been studies that show that people with depression um may be even more sensitive to errors, and then so you get this like speed accuracy trade-off that essentially happens. Um, and so it's not surprising that someone who's typing so much faster loses accuracy with it. And so those things actually do make sense in my mind. They're not slowing down, they're not checking for errors, right? They're not correcting things, they're letting autocorrect come in and do it.

SPEAKER_00:

Yeah, and and the erratic piece also kind of fits in, maybe because there's a fine balance between in these mood situations where maybe that you have a lot of things to say versus you don't want to say anything. And and having a lot of things to say forces you to sp to write faster, type faster, think faster, but also go make all those mistakes, right?

SPEAKER_01:

Um yeah, and the other thing that I'll mention is they did not look at anxiety, but there's a lot of times where people who have depressive mood features have overlapping anxiety. They might have, you know, some agitation. Yeah. And so they may end up trying to because they're cognitively a little bit slower from their depressed mood, they might try to like overcome that by typing faster.

SPEAKER_00:

Oh, interesting.

SPEAKER_01:

And so, of course, in that situation with that cognitive slowing and the fast typing, again, not surprising that you're gonna see more errors here.

SPEAKER_00:

Yeah, and I think that would be interesting to see because what we're seeing so far in the study is correlations. And the question is, why is this happening, right? And we are speculating or thinking about potential connections, and I'm sure uh there is research that's starting to be done about that, about exploring and diving deeper into these connections.

SPEAKER_01:

Yeah. I and I think at the end of the day, it's like it doesn't necessarily need to be a causal thing, right? You're trying to, we're trying to figure out, hey, can we monitor someone's mood in real time by using this metadata passively?

SPEAKER_00:

Yeah.

SPEAKER_01:

And, you know, it it's not like a huge study here, but the beginning, there's a beginning of a yes answer. And I think that is fascinating because you can start to build passively this like concept of a digital phenotype of someone, right? Like you get to know who an individual is based on some things that you can passively sense. In some ways, like putting on a wearable, you're like, okay, I know that I'm wearing it, right? I know that I'm wearing uh, you know, a Fitbit or whatever it is. But but your typing speed, you're not like thinking about that. You're not, you know, you can sign up for this study for sure, but you're not you're not considering that all the time. Right. And I think the idea here is there's there's a rich amount of data, and we can harness that to learn more and more about individuals in a passive way and get that more continuous feed of data so we can make adjustments in real time.

SPEAKER_00:

Yeah. That's I think that's a very exciting piece of it. But I do want to caution our listeners because it's very easy to go from there's a correlation to a causation that is specifically here where you you you can see the connection between the sort of typing data and mood, and you're like, okay, you know, does that mean that I can now predict someone's mood based on observing their how erratic they get in typing or whatever? And that is not what the paper is saying at all, right? That's I think it's really important to recognize that difference because you know, we don't know which direction the causality works, we don't know which way or if there's any other factors involved, but we don't know how these two the typing and and the mood, we don't know how they um uh uh uh influence each other exactly. We just know that there's a correlation between them.

SPEAKER_01:

Yeah, exactly. Um but I do think it's promising.

SPEAKER_00:

Yes, yes.

SPEAKER_01:

And I think it's it's really interesting. Like I never until we read this paper, I never really thought about, oh geez, I wonder if I use autocorrect. What does that say about my mood?

SPEAKER_00:

Yeah, well, that that that's it though. That's the question. That's the causality question that I'm hoping that we will get to get more insight on in the future.

SPEAKER_01:

Yeah, exactly. And I do think there's a component of even if you aren't able to establish causality, can this be used to track?

SPEAKER_00:

Yeah, yeah. Well, that's fair. That's true. Can this be used to track? Correct.

SPEAKER_01:

Because I think that was the goal here is like, can we understand how typing typing metadata and mood go along together with each other? Like, can we predict from this? Yeah, even if there's not causality, can we use this as a monitoring mechanism? And yeah, the answer is maybe.

SPEAKER_00:

Yeah, and the and the whole thing also, I think, that I I got really excited about was the fact that I didn't think about that there could be a connection here, but that's that's because I'm not an expert in this specific area. But um, what else can we be tracking in this way, right? There's so the sort of the world is our oyster, right?

SPEAKER_01:

Right. How else could we build out a digital phenotype on each of us as individuals? And I think uh when we were before we had that started the podcast, we were actually talking about, hey, wouldn't it be interesting if you compared yourself at one moment to yourself at another moment? Like, what's my baseline typing speed and accuracy? Yeah. And if I'm having like a bad day, what does it look like compared to that? So I think there's a lot of opportunity here to really dig in, get more personalized, whether it's different phenotypic markers or it's within this typing metadata and understanding like what is an individual's baseline and how does that vary when they're stressed, when they're anxious, um, when they have Alzheimer's disease. Right. Like there's there's so much that we could gather from this.

SPEAKER_00:

Yeah. Yeah.

SPEAKER_01:

All right. And with that, uh, we will see you next time on Code and Cure. Thank you for joining us.