Physical activity and cognitive function: between-person and within-person associations and moderators

ABSTRACT In the present study, we decomposed between- and within-person effects and examined moderators of the longitudinal physical activity-cognition association. Participants (N = 1722) were drawn from the Betula study and we included four waves of data across 15 years. Bayesian multilevel modeling showed that self-reported physical activity did not predict changes in cognitive function. Physical activity positively predicted cognitive performance at baseline, and the relations were stronger for more active (compared to less active) older adults. Physical activity had a positive within-person effect on cognitive function. The within-person effect of physical activity on episodic memory recall was stronger for participants who on average engaged in less physical activity. The within-person effect on verbal fluency was stronger for participants with more education. Our results suggest that preserving cognitive functioning in old age might be more a matter of what you do in old age than reflecting what you did earlier in life.


Introduction
Numerous studies have identified physical activity as a potent lifestyle factor that plays a critical role in preserving and even enhancing cognitive function across the life course (Engeroff et al., 2018;Prakash et al., 2015).Meta-analyses and systematic reviews indicate consistent patterns of prospective associations between engaging in more physical activity and reduced risk of cognitive decline and neurodegenerative diseases (e.g.Blondell et al., 2014;Hamer & Chida, 2009;Sofi et al., 2011).Intervention studies (e.g.Erickson et al., 2011;Jonasson et al., 2017) and meta-analyses of intervention studies have shown beneficial effects on many different cognitive domains (Barha et al., 2017;Colcombe & Kramer, 2003;Etnier et al., 2019;Northey et al., 2018;Smith et al., 2010).
Despite the wealth of evidence supporting the cognitive benefits of physical activity, few studies have decomposed between-and within-person effects (Kowalski et al., 2018;Robitaille et al., 2014).Between-person effects are used to describe how interindividual differences on one variable are related to interindividual differences on another variable.Between-person analyses involve attributes that are considered stable and reflective of the person as a whole, and these variables are time-invariant.The phrase within-person refers to the existence of intraindividual variation within a person when assessed repeatedly over time.Within-person effects are only directly observable when each person has been measured more than once.Within-person effects capture how variation relative to a person's own mean is related across variables and these variables are described as timevarying (Hoffman, 2015).Decomposing between-and within-person effects is important because results often differ between levels (Bielak et al., 2014;Kowalski et al., 2018;Schmiedek et al., 2019).
In addition, little is known about moderators of the longitudinal associations between physical activity and cognitive function (Erickson et al., 2019;J. L. Etnier et al., 2016;Leckie et al., 2012;Stillman & Erickson, 2018).A moderating variable is one that influences the effect (e.g.magnitude or direction) of an antecedent on an outcome (Preacher et al., 2016).Evidence of moderation is present if the relation between two variables (e.g.physical activity and cognition) is different across different levels of the moderating variable (e.g.age).Such information cannot be obtained by including variables as control variables or independent predictor variables.A greater understanding of moderators is important because it enables identification of subgroups that could particularly benefit from physical activity (Erickson et al., 2019;Etnier & Labban, 2012).Hence, in the current study we examined the longitudinal relation between physical activity and cognitive function, using multilevel modeling (B.O. Muthén & Asparouhov, 2011;Preacher et al., 2016) to decompose between-and within-person effects, and examined potential moderators of the physical activitycognition association.

Moderators of the relation between physical activity and cognitive function
Several moderators of the relation between physical activity and cognitive function have been suggested in the literature, such as age, apolipoprotein ε4 (APOE ε4), intellectual engagement (e.g.education), and sex (Erickson et al., 2019;Etnier & Labban, 2012;Leckie et al., 2012;Spirduso et al., 2008).Although researchers often include these variables as predictor or control variables, the moderating effect of these variables in the physical activity-cognition relation is seldom examined (Spirduso et al., 2008;Stillman & Erickson, 2018).In the current study, we examined the moderating effects of age, APOE ε4, education, sex, and average level of physical activity in the longitudinal relation between physical activity and cognitive function.

Age
Previous reviews and meta-analyses indicate that the magnitude of the relation between physical activity and cognitive function differs between age groups (Colcombe & Kramer, 2003;Etnier et al., 1997;Sibley & Etnier, 2003).More recently, a randomized controlled trial that included participants aged 20 to 67 years with below median aerobic capacity showed that the effects of aerobic exercise on executive function were more pronounced as age increased (Stern et al., 2019).Another longitudinal study showed within-person level relations between physical activity and a composite of fluid cognitive ability (i.e.perceptual speed, short-term memory, working memory, and episodic memory) in the youngest age group (20-24 years at baseline), but not in the middle-aged group (40--44 years at baseline), or older group (60-64 years at baseline; Bielak et al., 2014).Although the impact of age in the relation between physical activity and cognitive function has varied considerably between studies, ample evidence supports age as a potential moderator of the relation between physical activity and cognitive function (e.g.Bielak et al., 2014;Colcombe & Kramer, 2003;Etnier et al., 1997;Richards et al., 2003).

APOE ε4
The APOE ε4 allele is a known risk factor for the development of Alzheimer's disease (e.g.Corder et al., 1993;Saunders et al., 1993;Verghese et al., 2011) and has been associated with poorer cognitive performance and more rapid cognitive decline in nondemented individuals (e.g.Rawle et al., 2018;Ritchie et al., 2019;Wisdom et al., 2011).The APOE ε4 allele has also been found to enhance the negative effects of other risk factors for cognitive decline (Haan et al., 1999).Given these links between the APOE ε4 allele and cognitive decline, several studies have examined if the relation between physical activity and cognition differs between carriers and noncarriers.Evidence from cross-sectional (Deeny et al., 2008;Etnier et al., 2007) and prospective studies (e.g.Krell-Roesch et al., 2016;Luck et al., 2014;Niti et al., 2008;Pizzie et al., 2014;Podewils et al., 2005;Rovio et al., 2005;Schuit et al., 2001) indicate that the relation between physical activity (or aerobic fitness) and cognitive function (or the clinical diagnosis of dementia) may be moderated by APOE genotype.The general pattern of results suggests that the cognitive benefits of physical activity are more pronounced among carriers of the APOE ε4 allele (i.e.those most at risk for cognitive decline and Alzheimer's disease, however, see Podewils et al., 2005, who found the opposite effect).Although these studies have provided preliminary evidence that the APOE ε4 allele moderates the physical activity-cognition relation, several gaps remain in the literature.Of note, the previous prospective studies did not distinguish between-and within-person effects, did not include repeated assessments of physical activity and cognitive function, and they were focused on baseline predictors of cognitive decline or dementia.

Education
Education has been linked to better cognitive function in adults (Opdebeeck et al., 2016) and a delayed onset of accelerated cognitive decline (Clouston et al., 2019).A recent meta-analysis estimated that each additional year of education provides cognitive benefits of approximately 1 to 5 IQ points; effects that persisted across the life course and were present for a broad range of cognitive abilities (Ritchie & Tucker-Drob, 2018).Experiences such as education and other cognitively stimulating leisure activities are proposed to create a buffer against the effects of brain damage or pathology, which helps the individual to cope with brain damage by using preexisting cognitive processes or by enlisting compensatory processes (Stern, 2009).Lifestyle factors that involve physical activity may also protect against future brain damage and pathology (Whalley et al., 2004).People who are more physically active are thus expected to perform cognitively well even when facing advancing age or pathology that is expected to reduce their cognitive ability (Etnier & Labban, 2012).Although proposed as a potential moderator of the relation between physical activity and cognitive function (Bielak, 2010;Spirduso et al., 2008), few studies have directly tested the moderating effect of education.Lindwall et al. (2012) found that the relation between self-reported physical activity and semantic knowledge at baseline was stronger for people with less education, whereas Kowalski et al. (2018) found that self-reported moderate-to-vigorous walking had a stronger within-person relation with accuracy on a working memory task (2-back) among those with higher education.These findings tentatively suggest that education may influence the physical activity-cognition relation; however, it is difficult to specify clear hypotheses about the direction of the moderating effect of education based on previous research.

Sex
Sex has also been proposed as a potential moderator of the relation between physical activity and cognitive function (e.g.Barha et al., 2017;Barha & Liu-Ambrose, 2018).In a twowave study with men and women over 65 years old, baseline physical activity habits (i.e.active vs. sedentary) predicted risk of cognitive impairment, dementia, and Alzheimer's disease in women but not men, such that women active at baseline had about 50% less risk (Laurin et al., 2001).In contrast, no statistically significant effects were found for the men in the study.Meta-analytic findings of randomized controlled trials indicate that the positive effect of physical activity on cognitive function is larger in samples with a larger percentage of women compared to samples with a larger percentage of men (Barha et al., 2017;Colcombe & Kramer, 2003).However, research also suggests that sex differences may be more prominent for some cognitive functions (e.g.executive functions) than others (e.g.visuospatial ability, episodic memory; Barha et al., 2017).Another factor that may contribute is that older women tend to be more sedentary and engage less in physical activity than older men (Guiney et al., 2018;Kaplan et al., 2001;Lee, 2005), and as a consequence the effect of increasing physical activity in women may have a greater impact on cognition (Barha & Liu-Ambrose, 2018).Taken together, research to date indicates that sex may be an important moderator of the relation between physical activity and cognitive function and that the cognitive benefits appear to be greater for older women than for older men.

Physical activity
Research indicates that optimal effects of physical activity on neurocognitive preservation are obtained by maintaining a physically active lifestyle throughout the life course (Gaertner et al., 2018;Nyberg & Pudas, 2019).On the other hand, research also indicates that the cognitive benefits of physical activity are greater for those who are less active (Barha & Liu-Ambrose, 2018;Stillman & Erickson, 2018).As such, engaging in more physical activity should be related to higher cognitive performance at the betweenperson level.However, it is also likely that the within-person effect (i.e.occasion-specific deviations from the participants own mean trajectory) of physical activity on cognition is stronger among individuals with lower average level of physical activity.

The present study
The aims of the present study were to examine the longitudinal relations between physical activity and cognitive function, decompose between-and within-person effects, and examine moderators of the physical activity-cognition association in adults.Three different cognitive domains were targeted in the current study: episodic memory recall, verbal fluency, and visuospatial ability.These cognitive domains were of interest because they are known to be age sensitive and have been related to physical activity in adults and older adults (e.g.Boraxbekk et al., 2016;Brown et al., 2012;Hayes et al., 2015).Episodic memory reflects our ability to mentally travel in time.This includes, for instance, our capacity to retain personally experienced information from the past.Episodic memory is considered to be a rather fluid ability because it is less dependent on acquired knowledge than crystallized abilities (Tulving, 1972(Tulving, , 1983)), and a gradual mean level deterioration is evident past the age of 60 (Rönnlund et al., 2005).Episodic memory recall, sometimes regarded as a subsystem of episodic memory, is our ability to recollect information that we have a mental representation of, thus often makes it possible for us to verbalize (Saumier & Chertkow, 2002).Verbal fluency facilitates information retrieval from memory.Verbal fluency tasks require word knowledge and semantic processing, but are also dependent on executive control processes (McDowd et al., 2011).The reason that verbal fluency tasks are more age sensitive than traditional tests of semantic knowledge is probably because they include activation of several cognitive components (Nyberg et al., 2003), and the combined mental demands thereof are more difficult for elderly to handle, in general.Visuospatial ability reflects the capacity to identify visual and spatial relationships among objects.In this study, WAIS-R Block Design Test (Weschler, 1981) was used as a measure of visuospatial ability.However, it should be noted that this task sometimes is used as an indicator of Gf, and also is related to executive functioning (Lezak et al., 2004;Morton, 2010).Thus, our findings must be interpreted in light of this.
In the current study we examined four main questions: (1) Is baseline level of physical activity related to baseline levels and changes across 15 years in cognitive function (between-person level analysis)?(2) Is the relation between baseline level of physical activity and baseline levels and changes across 15 years in cognitive function moderated by age, APOE ε4 status, years of education, and sex (between-person level analysis)?(3) Is physical activity related to cognitive function at the between-person level (i.e.average levels across the study period) and within-person level (i.e.occasion-specific deviations from the participants own mean trajectory)?and (4) Do age, APOE ε4 status, years of education, sex, and average level of physical activity moderate the relation between physical activity and cognitive function at the within-person level (i.e.occasion-specific deviations from the participants own mean trajectory)?

Study population
The data used in the present study was collected within the Betula prospective cohort study (Nilsson et al., 2004(Nilsson et al., , 1997)).This study of aging, memory, and health was conducted in Umeå, Sweden, commencing in 1988.Participants were selected by stratified (age, sex) random sampling from the population registry of Umeå municipality.Previous studies have found that the samples are representative of the target population with regard to demographic factors such as education, income, and marital status (Nilsson et al., 1997).Participants were tested at 5-year intervals, and six test (T) waves have been executed, T1 (1988-1990), T2 (1993-1995), T3 (1998-2000), T4 (2003-2005), T5 (2008-2010), and T6 (2013-2014).At each test wave, participants visited the test locations over two sessions, the first with focus on health assessment, and the second on cognitive functioning.Six samples (S) have been included, S1 (T1-T6), S2 (T2-T3), S3 (T2-T6), S4 (T3), S5 (T4), and S6 (T5).For the purpose of the current study only S1 and S3 were included, because these are the only two samples with comprehensive longitudinal data on physical activity and the cognitive variables.T2 was used as baseline as questions about physical activity were introduced at this measurement point and T6 was not included because the recruitment procedure at T6 was different from the procedure at T2 to T5.Hence, we included four measurement points (T2-T5) and the total study length was 15 years.All participants provided written informed consent at study inclusion.

Participants
Of the 1966 available participants from S1 and S3, 244 participants were excluded from the analyses due to missing data on the covariates or moderator variables (n = 241) or dementia diagnosis at baseline (n = 3).Participants with missing data on the cognitive variables at all time points were also excluded from the analyses.The total number of participants used in the analyses (i.e.participants with at least one score at any of the assessments) was 1719 for episodic memory, 1722 for verbal fluency, and 1712 for visuospatial ability (47% from S1 and 53% from S3).At baseline the mean age of the sample was 61.5 years (SD = 14.0, range 40-85 years), the participants had an average of 10.3 years of education (SD = 4.4, range 2-31 years), and the sample consisted of 55% women.

Physical activity
Physical activity was assessed using a single-item question that was a part of a questionnaire sent to the participants to complete before the health assessment (Josefsson et al., 2012).Participants responded to how often they had done Sports/ Exercise/Walking in the forest during the last three months.Frequency of physical activity was rated as never (1), occasionally (2), a few times a month (3), sometime per week (4), and every day (5).

Episodic memory recall
Five measures were used to assess episodic memory recall ability (for a more detailed description, see Nilsson et al., 2004Nilsson et al., , 1997;;Rönnlund & Nilsson, 2006).These were: (1) Action Recall (AR), in which the participants were instructed to perform 16 verb-noun actions (e.g.lift the book).After all actions had been completed, free recall followed.The number of correctly recalled sentences (verb + noun) was used.(2) Sentence Recall (SR): participants studied 16 verb-noun sentences written on separate sheets.Each sentence was also read aloud by the test leader and completely recalled sentences (verb + noun) was used as a measure of performance.Duration for each stimuli presentation was 8 seconds and maximum time for recall was 2 minutes.(3) Category-Cued Recall (CCR-AR) of nouns from the actions performed, and (4) Category-Cued Recall (CCR-SR) of nouns from the sentences studied.Eight semantic cues written on a sheet were presented to the participant.Half of them referred to the actions, and half of them to the sentences.Time for recall was 3 minutes.The maximum score for each CCR was 16 points.(5) Free Recall (FR) of 12 nouns that were read aloud by the test leader.Each word was presented at a pace of 2 seconds and time for immediate free recall was 45 seconds.Composite scores based on similar episodic memory tasks have shown stability over time, with five-and ten-year stability coefficients of .83 and .82,respectively (Rönnlund & Nilsson, 2006).Performance in each episodic task was used to create a composite score of episodic memory recall.The episodic memory test score can a priori range from 0 to 76 and a higher score indicates better episodic memory (cf.Josefsson et al., 2012).

Verbal fluency
Performance in three fluency tasks was used as measures of verbal fluency (Nyberg et al., 2003).In each task, the goal is to verbally generate as many words as possible within one minute (except names).These were: (1) Fluency A (FLA): recall words with initial letter A. (2) Fluency M (FLM): generate words that contain exactly five letters and have initial letter M. (3) Fluency B (FLB): recall occupations with initial letter B. A composite score of the number of recalled words in each task was used as an indicator of verbal fluency.A composite score of these fluency tasks has shown five-and ten-year stability coefficients of .83 and .78,respectively (Rönnlund & Nilsson, 2006).We summed the scores of three fluency tasks into a composite score with higher scores indicating better verbal fluency.

Visuospatial ability
Results from the WAIS-R Block Design Test (Weschler, 1981) was used as an indicator of visuospatial ability.In this test, the participant must arrange a number of bicolored blocks (red-white) into patterns that correspond to targets presented on sheets.Targets are presented with ascending difficulty and they require either a set of four or nine blocks to be solved.The time limit is either one or two minutes, depending on task difficulty.Within the Betula study the Block Design tasks have shown five-and ten-year stability coefficients of .81 and .80,respectively (Rönnlund & Nilsson, 2006).The raw score, calculated from the number of patterns solved and the time taken to solve them, was used in the analyses.

Moderators and covariates
Age at baseline (T2), APOE ɛ4 status (0 = noncarrier, 1 = carrier), years of education (i.e. the maximum number of years reported over the four assessments), and sex (0 = female, 1 = male) were included as moderators in the analyses.Genotyping was carried out using polymerase chain reaction (for detailed procedure, see L.-G.Nilsson et al., 2006).As the APOE ɛ4 allele is a known risk factor for cognitive impairment (Corder et al., 1993), participants were grouped into carriers (28%) and non-carriers (72%).We included sample (i.e.S1 or S3) as a control variable in the analyses to account for potential practice effects (cf.Rönnlund et al., 2005).

Statistical analysis
Mplus version 8.2 (Muthén & Muthén, 1998-2017) was used to estimate Bayesian multilevel models.Two different types of multilevel models were estimated.First, we estimated multilevel growth curve models to assess baseline level (i.e. the intercept) and the average rate of change (i.e. the slope) across the study period (i.e. 15 years) in each of the cognitive variables.We estimated random intercepts, linear slopes, and quadratic slopes for all cognitive variables.Quadratic slopes were only retained in the models if the 95% credibility interval (CI) for the quadratic slope mean did not include zero.Time in study (i.e.0, 5, 10, 15 years) was used as the time metric and the intercept was placed at baseline (T2).Hence, the linear slope factor represents the average rate of change per five years and the quadratic slope represents the rate of acceleration.
In the second step, we added baseline (T2) level of physical activity, age, APOE ε4 status, education, and sex as between-person level predictors of the intercept and slopes.The between-person level predictors (i.e.baseline physical activity, age, and years of education) were grand-mean centered.Dichotomous predictors (i.e.APOE ɛ4 status, sex) were dummy coded as 0 and 1.In the third step, we added interaction terms between baseline level of physical activity and age, APOE ε4 status, education, and sex as betweenperson level predictors of the intercept and slope factors.
Second, we estimated multilevel path analyses where the relation between physical activity and cognitive function was specified at both the between-and within-person level.Relations at the between-person level in the multilevel path analyses refer to relations between average levels of physical activity and cognitive function across the 15-year study period.In line with current recommendations time was included as a predictor of cognitive function at the within-person level to control for time effects (Wang & Maxwell, 2015).We used the within-person level slope (physical activity → cognitive function) as a random slope at the between-person level to examine the moderating effects of the betweenperson level variables on the within-person level relation between physical activity and cognitive function (i.e.cross-level interaction/moderation across levels of analysis; Preacher et al., 2016).Hence, the slope does not represent the average rate of change as in the multilevel growth model, instead it represents the within-person level relation between physical activity and cognitive function (i.e.occasion-specific deviations from the participants own mean trajectory) net the time effect (Wang & Maxwell, 2015).Latent mean centering (Asparouhov & Muthén, 2019) was used for the within-person level variables.With latent mean centering, the within-person level variable is decomposed into a latent between and within part, which can be viewed as an implicit group-mean centering of the within-person level variable (cf.Lüdtke et al., 2008).The between-person level predictors (i.e.age and years of education) were grand-mean centered.Dichotomous predictors (i.e.APOE ɛ4 status, sex) were dummy coded as 0 and 1.
The Bayesian multilevel models were estimated using four Markov chain Monte Carlo (MCMC) chains and 10,000 iterations.We used thinning to reduce autocorrelations and the posterior distributions was made up of every 10 th MCMC draw (Gelman et al., 2014).The first 5,000 iterations are discarded as burn-in and the remaining 5,000 iterations are used to estimate the posterior distribution of the parameters.Chain convergence was assessed using the potential scale reduction factor (PSFR; Brooks & Gelman, 1998) where a low (e.g.< 1.05) and stable PSFR was considered as evidence of chain convergence.We relied on the default noninformative prior specification in Mplus (see L. K. Muthén & Muthén, 1998-2017, p. 775 for a description of the default priors when Bayesian estimation is used).Parameter estimates were evaluated using the 95% credibility intervals (CI).If the 95% CI did not include zero, it was considered as a credible parameter estimate (Zyphur & Oswald, 2015).With the exception of excluding participants due to missing data and dementia diagnosis at baseline, we used all available data in the analysis.

Results
Descriptive statistics of the self-reported physical activity and cognitive tests are displayed in Table 1.

Physical activity and cognitive function: baseline levels and changes over time
In the first set of models (i.e. the multilevel growth curve models) we examined the effects of baseline level of physical activity on baseline levels and changes (i.e.decline) in cognitive function over time as well as interaction effects between baseline level of physical activity and age, APOE ε4 status, years of education, and sex.The results from the multilevel growth curve models are presented in Table 2 for episodic memory recall, Table 3 for verbal fluency, and Table 4 for visuospatial ability.
When adding interaction terms to the model, the interaction between baseline level of physical activity and age was a credible predictor of baseline level of episodic memory recall (estimate = 0.038, 95% CI [0.012, 0.064]).Older participants who engaged in more physical activity at baseline showed better episodic memory performance at baseline compared to older participants who were less active.None of the other interaction terms had a credible effect on baseline level or change in episodic memory recall.
predictors.The pattern of credible effects show that older participants had a more rapid decline in verbal fluency.
When adding the interaction terms to the model, the interaction between baseline level of physical activity and age was a credible predictor of baseline level of verbal fluency (estimate = 0.049, 95% CI [0.027, 0.071]).These results show that older participants who engaged in more physical activity at baseline showed better verbal fluency at baseline compared to older participants who were less active.None of the other interaction terms had a credible effect on baseline level or change in verbal fluency.
When adding the interaction terms to the model, the interaction between baseline level of physical activity and age was a credible predictor of baseline level of visuospatial ability (estimate = 0.026, 95% CI [0.001, 0.052]).These results show that older participants who engaged in more physical activity at baseline showed better visuospatial ability at baseline compared to older participants who were less active.None of the other interaction terms had a credible effect on baseline level or change in verbal fluency.

Physical activity and cognitive function: within-person level relations and cross-level interactions
In the second set of models (i.e. the multilevel path analyses), we examined between-and within-person level relations between physical activity and cognitive function as well as cross-level interactions.We focused on potential moderators at the between-person level of the within-person level relation between physical activity and cognitive function.The results from the multilevel path analyses and the cross-level interactions are presented in Table 5.
There was a credible within-person level effect of physical activity on episodic memory recall (random slope = 0.686, 95% CI [0.435,0.939],variance = 3.339,95% CI [2.048,4.834]),indicating that at measurement points when participants engaged in more physical activity, they also showed better episodic memory performance.Average level of physical activity (estimate = −0.539,95% CI [−0.977, −0.098]) moderated the within-person relation between physical activity and episodic memory recall.These results indicate that the within-person relation was stronger for less active participants.None of the other moderating variables had a credible effect.
There was a credible within-person level effect of physical activity on verbal fluency (random slope = 0.296, 95% CI [0.114, 0.475], variance = 0.992, 95% CI [0.365, 1.780]), indicating that at measurement points when participants reported that they engaged in more physical activity than usual, they also showed better verbal fluency performance.Years of education (estimate = 0.052, 95% CI [0.001, 0.105]) moderated the within-person relation between physical activity and verbal fluency indicating that the relation was stronger for participants with more years of education.None of the other moderators had a credible effect on the within-person relation between physical activity and verbal fluency.
There was a credible within-person level effect of physical activity on visuospatial ability (random slope = 0.255, 95% CI [0.080, 0.435], variance = 0.283, 95% CI [0.049, 0.780]), indicating that at measurement points when participants engaged in more physical activity than usual, they also showed better visuospatial ability.However, none of the moderators had a credible effect on the within-person relation between physical activity and visuospatial ability.

Discussion
In the current study, we examined longitudinal relations between physical activity and cognitive function (i.e.episodic memory recall, verbal fluency, and visuospatial ability), decomposed between-and within-person effects, and examined potential moderators of the physical activity-cognition association.The results showed that physical activity was related to cognitive function at baseline and these relations were stronger for older adults.However, baseline level of physical activity was not related to changes in cognitive function.At the within-person level, physical activity was positively related to all three cognitive outcomes.The within-person level relation between physical activity and episodic memory recall was stronger for less active individuals, whereas the within-person level relation between physical activity and verbal fluency was stronger for those with more years of education.Table 6 provides a summary of the main findings of the current study.

Between-and within-person effects
We found that people with higher baseline level of physical activity performed better on the episodic memory recall, verbal fluency, and visuospatial ability tests at baseline.These findings are consistent with previous research showing a positive between-person relation between level of physical activity and baseline cognitive ability (e.g.Bielak et al., 2014;Gow, Corley et al., 2012;Gow, Mortensen et al., 2012;Guiney et al., 2019;Lindwall et al., 2012).However, as noted by several researchers (e.g.Bielak et al., 2014;Lindwall et al.,  Multilevel growth model with predictors at the between-person level Higher level of physical activity at baseline was related to better episodic memory recall, verbal fluency, and visuospatial ability at baseline.Relations between baseline physical activity and changes in episodic memory recall, verbal fluency, and visuospatial ability were not credible. (2) Is the relation between baseline level of physical activity and baseline levels and changes across 15 years in cognitive function moderated by age, APOE ε4 status, years of education, and sex (i.e.between-person level analysis)?
Multilevel growth model with predictors and interaction terms at the between-person level Older participants who engaged in more physical activity at baseline showed better episodic memory recall and verbal fluency performance at baseline compared to older participants who were less active.
None of the interaction terms had a credible effect on changes in episodic memory recall, verbal fluency, and visuospatial ability.
(3) Is physical activity related to cognitive function at the between-person level (i.e.average levels across the study period) and within-person level (i.e.occasion-specific deviations from the participants own mean trajectory)?
Multilevel path analysis At the between-person level, higher average level of physical activity was related to higher average levels of episodic memory recall and verbal fluency across the 15-year study period.
At the within-person level, engaging in more physical activity than usual was related to better episodic memory recall, verbal fluency, and visuospatial ability than usual at each measurement point.
(4) Do age, APOE ε4 status, years of education, sex, and average level of physical activity moderate the relation between physical activity and cognitive function at the within-person level (i.e.occasion-specific deviations from the participants own mean trajectory)?
Multilevel path analysis with moderation across levels of analysis (i.e.cross-level interactions).The within-person relation between physical activity and episodic memory recall was stronger for participants who on average were less physically active.
The within-person relation between physical activity and verbal fluency was stronger for participants with more years of education.
2012), these between-person relations with baseline cognitive ability, which are well documented in the literature, do very little to advance our understanding of the likely very complex relation between physical activity and cognition.
Relations between physical activity and changes in cognitive function are much more informative than baseline associations.In the present study, baseline level of physical activity was not a credible predictor of changes in any of the cognitive outcomes.The lack of between-person relations linking baseline level of physical activity and changes in cognitive function may be an indication of preserved differentiation (cf.Bielak, 2010;Bielak et al., 2014;Salthouse, 2006).Hence, individuals who engaged in more physical activity appear to have had a higher initial cognitive ability and this cognitive advantage was maintained over time, rather than physical activity having a long-term protective effect against cognitive decline.
The absence of relations between physical activity and changes in the cognitive outcomes are in line with some previous studies (e.g.Bielak et al., 2014Bielak et al., , 2007) ) and stand in contrast to others (e.g.Daly et al., 2015;Gow, Mortensen et al., 2012;Lindwall et al., 2012) .
Regarding the latter studies it should be noted that Daly et al. (2015) found a stronger effect of executive function (i.e. an index based on verbal fluency and letter cancelation tasks) on subsequent physical activity (i.e.50% larger in magnitude) than the effect of physical activity on subsequent executive function in a sample of older adults.Lindwall et al. (2012) only found a relation between baseline physical activity and less decline in verbal fluency in older adults, but did not find an association between baseline physical activity and changes in semantic memory, knowledge, or reasoning (i.e.block design test).Finally, Gow, Mortensen et al. (2012) found that physical activity at age 60 and 70 predicted less decline from age 60 to 80 in a latent general cognitive ability factor (i.e. based on four subtests: digit symbol, block design, digit span, and picture completion).As such, there is some evidence that baseline or average physical activity level may have a protective longterm effect on some cognitive domains.However, there is a large heterogeneity between studies (e.g.regarding cognitive and physical activity measures, measurement intervals, and age range) and most studies included older adults (but see Richards et al., 2003 for an exception including middle-aged adults [36 years at baseline]).Our study included a slightly wider age range (i.e.40-85 years at baseline) and our results are in line with other studies including samples across the adult life span (Bielak et al., 2014).
In addition to the more stationary between-person level relations, we also examined dynamic within-person level relations between physical activity and cognitive function.These represent occasion-specific within-person relations between physical activity and cognitive function, while controlling for the average rate of change over time.In line with previous studies (e.g.Bielak et al., 2014;Daly et al., 2015;Kowalski et al., 2018;Lindwall et al., 2012) we found consistent within-person level relations between physical activity and all three cognitive outcomes.The magnitude of these within-person relations were stronger for episodic memory recall (0.686) than for verbal fluency (0.296) and visuospatial ability (0.255) and the pattern suggests that fluctuations from wave to wave in physical activity around individuals' mean trajectory was related to corresponding fluctuations in all three cognitive domains.
That we observed within-person level relations between physical activity and all three cognitive outcomes, but no long-term relations between physical activity and changes in cognitive function, indicates that the brain needs constant stimulation to achieve cognitive benefits (Nyberg & Pudas, 2019).This is in accordance with use-dependency theories, which suggest that preserving cognitive functioning in old age is more a matter of what you do in old age than reflecting what you did earlier in life (Almond, 2010;Lövdén et al., 2010).Hence, our results suggest that continuous engagement in physical activity is most likely to have cognitive benefits, whereas the idea that previous physical activity will have a long-term protective effect on cognitive function was not supported.

Moderators of the physical activity-cognition relation
We found that age moderated the relation between level of physical activity and all three cognitive outcomes at baseline such that the relation was stronger among older participants.More specifically, older participants who were more physically active at baseline performed better on the cognitive tests at baseline compared to older participants who were less active.These findings may be related to changes in brain structure and function that occur with adult aging (J.L. Etnier et al., 2019).Physical activity has been found to predict total brain volume and gray matter volume (Rovio et al., 2010), as well as regional brain volume in some areas (e.g.hippocampus; Erickson et al., 2011), which are vulnerable to age-related decline (Raz & Rodrigue, 2006).Neural activation, functional connectivity, and cerebral blood flow are also negatively affected by aging, but have been shown to be positively affected by physical activity (Kennedy et al., 2017;Etnier et al., 2019).That physical activity affects both brain structure and function, which are well known to decline with age, suggests that the favorable effects of physical activity may become even more evident in old age (cf.Etnier et al., 2019;Stern et al., 2019).However, given the mixed findings in the literature and heterogeneity between studies on the moderating effects of age on the physical activity-cognition relation (cf.Bielak et al., 2014;Colcombe & Kramer, 2003;Etnier et al., 1997;Stern et al., 2019), more research on this topic is warranted.
At the within-person level, the effect of physical activity on episodic memory recall was stronger for less active participants.This finding is in line with recent suggestions that the health benefits (including cognitive benefits) of physical activity may be most pronounced for less active and unfit individuals (Barha & Liu-Ambrose, 2018;Stillman & Erickson, 2018).Today, it is well established that encoding and retrieval processes involved in episodic memory functioning are heavily dependent on the hippocampal formation (Moscovitch et al., 2005;Squire & Schacter, 2002).It is also well documented that with aging there is decline in hippocampal volume (e.g.O'Shea et al., 2016) and that aerobic fitness and physical activity is related to hippocampal volume in older adults (e.g.Erickson et al., 2011;Firth et al., 2018;Etnier et al., 2019).Thus, one possible explanation to the finding is that physical activity can both positively influence hippocampus structure and function, and that increases in activity level therefore can be particularly valuable for less active individuals.
We also found that years of education moderated the within-person level effect of physical activity on verbal fluency.This may suggest that some cognitive benefits of physical activity are more pronounced for people who over the life course have engaged in intellectually stimulating activities (e.g.education).The findings in the current study contrasts with a previous finding showing that the effect of physical activity on cognition was larger among those with less education (e.g.Lindwall et al., 2012).However, the interaction between physical activity and education was related to a different cognitive outcome in the current study (i.e.verbal fluency) when compared to Lindwall et al. (2012) who found an association with sematic knowledge.Another previous study showed that the interaction between physical activity and education was positively associated with working memory (Kowalski et al., 2018), which suggests an additive effect on cognition in the presence of several protective factors.Evidence from meta-analyses and systematic reviews indicate larger effects of combined cognitive and physical interventions on cognitive function, when compared to a control group or a physical intervention on its own (Etnier et al., 2019;Zhu et al., 2016).This suggests that the presence of several protective factors (e.g.physical activity and cognitively stimulating activities) may have additive effects on cognitive function.However, more research examining moderators of the physical activity-cognition relation is warranted to increase our understanding of this complex relation.

Limitations
A few limitations of the current study should be noted.First, we used a rather crude single-item measure of how often individuals engage in physical activity.For example, the measure did not capture information about the duration or intensity of the participants' physical activity.In addition, the question used in this study was restricted to certain activities and therefore we do not know whether participants engaged in physical activities other than those enquired about.Second, with five-year measurement intervals we were able to capture long-term changes and associations between physical activity and cognitive function.However, because of the design we were not able to capture short-term changes or fluctuations in physical activity and cognitive function.Using a more intensive longitudinal design, such as a measurement-bursts design (Scott et al., 2015;Sliwinski, 2008), could aid our understanding of the link between short-and longterm changes in physical activity and cognition.Third, our analyses cannot disentangle the direction or causation of the relation between physical activity and cognition.Based on the current data we are not able to tease out if those engaging in more physical activity always had better cognitive function or if those with higher cognitive functions have been more physically active throughout the life course.More research on the direction of the physical activity-cognition relation is warranted (cf.Bielak, 2010;Stillman & Erickson, 2018).Fourth, we only examined a limited set of moderators; future studies should explore other potential moderators such as dietary factors, fitness level, genes (other than APOE), and other factors such as type of physical activity or other leisure activities (Erickson et al., 2019;Leckie et al., 2012;Spirduso et al., 2008).

Conclusions
Our results did not support a long-term protective effect of previous physical activity on cognitive function; instead, they indicate that continuous engagement in physical activity has cognitive benefits, which is more in line with use-dependency theories (Almond, 2010;Lövdén et al., 2010).Overall, we observed few moderating effects of the physical activitycognition relation and the observed moderators (i.e.age, average level of physical activity, and years of education) were not consistent across levels of analysis or cognitive outcome.In line with previous findings (e.g.Bielak et al., 2014;Kowalski et al., 2018;Lindwall et al., 2012;Schmiedek et al., 2019), the findings of the current study also highlight the importance of decomposing effects at the between-and within-person level and separating level and change across time when examining predictors of cognitive function.

Table 1 .
Descriptive statistics of the physical activity and the cognitive test scores.

Table 3 .
Parameter estimates from the multilevel change model with between-level predictors (Model 2a) and interactions (Model 2b) for verbal fluency (n = 1722).

Table 2 .
Parameter estimates from the multilevel change model with between-level predictors (Model 1a) and interactions (Model 1b) for episodic memory recall (n = 1719).

Table 4 .
Parameter estimates from the multilevel change model with between-level predictors (Model 3a) and interactions (Model 3b) for visuospatial ability (n = 1712).

Table 5 .
Parameter estimates from the cross-level interaction models.

Table 6 .
Summary of the main findings.