Detected Affect During Online Mathematics Learning Mediate Self-Report Motivation Changes: Examining a Motivation-Affect Regulation Model

: This study investigates relationships between detected affect during online learning and self-reports concerning motivational constructs in mathematics. Students reported their self-concept, interest, and values in mathematics before and after learning mathematics on an online intelligent tutoring system for one academic year over the autumn and spring semesters. Students’ experiences of engaged concentration, confusion, frustration, and boredom were detected using log files from the system. The participants included over 8,000 2nd-to 8th-grade students in the United States who used an intelligent tutoring system, Reasoning Mind, during the academic year of 2017-2018. Path analyses with mediating effects indicate that students initially perceiving high self-concept are less frustrated in both autumn and spring. Students interested in mathematics experience initial disengagement and later confusion in online mathematical problem-solving. This result calls for cross-platform support from teachers and system designs, especially for students interested in traditional mathematical teaching and learning. For theory, this study posits the Motivation-Affect Regulation (MAR) model, highlighting the mediating effects of motivation effect. Results find that the earlier self-concept can be mediated by fewer frustrations in online learning and lead to later self-concept. Interest triggers early disengagement and late confusion during online learning. Value is not mediated by affect. In methodology


Introduction
Traditionally, mathematics education researchers and educational psychologists use self-report questionnaires, scales, or (oral or written) text to study attitudes, beliefs, emotional responses, or motivation (Blikstein & Worsley, 2016;Gomez-Chacon, 2000;Hannula, 2002;McLeod, 1994;Pintrich, 2003). For topic-oriented methods, one of the most traditionally, perhaps also widely, used self-report tools to study affect is Likert-type scales for domain-specific learning (e.g., mathematics) (D'Mello et al., 2017). Multimodal data with learning analytics and personalised artefacts elect as suitable process-oriented methods (Blikstein & Worsley, 2016). Among the diverse multimodal methods, even though the self-report, the learner output, or physical measures are useful tools (Pachman et al., 2016), the advance of educational technology gives birth to real-time affect (automatically) detected by machine learning algorithms using online, behavioural log-file data, which appear to be the most efficient method. Besides, both self-report motivation and detected affect are related to achievement in theory (McLeod, 1994) and empirical studies (Marsh & Hau, 2004;Wang & Baker, 2018). The self-report and automatically detected measures may compensate each other. The self-report measures are more based on conscious expressions (e.g., stating "I like mathematics.") and detected measures are more based on unconscious physical behaviour (e.g., clicking on hints when failing to solve problems on an online learning system). This further evidences criterion validity for both the self-report affect and the detected affect.
This study is exploratory in nature and related to three fields: mathematics education, psychology, and educational technology. The term use of affect-related constructs appears to be different in these three fields. This study chooses to use 'motivation' to represent "domain-specific non-real-time affect regarding mathematical learning" (i.e., topic orientation) and 'affect' to represent "the real-time affect during mathematical problem-solving" (i.e., process orientation) (D'Mello & Mills, 2014). In terms of methodology, this study focuses on (offline Likert-type scale) "self-report motivation" and (online automatically) "detected affect." Relationships between online behaviours and self-reports have been an emerging research field in learning analytics (van Halem et al., 2020). However, the past studies on longitudinal, interactive relationships between the self-report motivation and the detected affect appear to only explore their simple relationships (i.e., correlations) (a relevant study omitted for blind review, 2018). This study attempts to investigate their relationships by fully utilising a longitudinal, experimental design: the pretest self-report motivation, the detected affect during online learning in the first and second semesters, and then the post-test self-report otivation (cf. Model 1 in Figure 2). This design offers an opportunity to investigate the longitudinal development of both self-report motivation and detected affect, and their interactions overtimes.

Research Problem
During learning, students may regulate their person-level motivation and situation-level affect (Efklides, 2011). The person level is the trait-like, general, or metacognitive knowledge (of person/self, tasks, and strategies), affect, and motivation. This is normally a top-down process. Motivation (at the person level) plays a role in affect during problem-solving situations (at the person*task level). Affect in turn predicts a later academic (e.g. language) performance (Gillet et al., 2013).
The task person level includes explicit knowledge, conscious analytic process, and unconscious process. All these directly relate to behaviour during hands-on, online task processing. This is a bottom-up process. Affect during problem-solving "updates" motivation (Baars et al., 2017) through the process of "feedback" (Efklides, 2011, p. 20). The use of "update" implies that affect at the task person level rewrites motivation at the person level after a timely experience related to motivation.
The bi-direction motivation effects and the mutual affect suggest a reciprocal relationship between motivations and affect over time. That is, motivation impacts affect and the affect updates motivation, which per se is a self-regulated learning (SRL) process. Figure 1 hypothesizes an SRL process as the reciprocal relationship between motivation (at the personal level) and affect (at the task personal level). This motivation-affect regulation (MAR) model serves as the theoretical basis of this study.

Figure 1
The Motivation-Affect Regulation (MAR) model Source: author own development

Diverse Constructs of Motivation
Different types of motivation such as self-efficacy or competence beliefs (self-concept), control beliefs, interests, values, and goals are identified in Educational and psychological researches (Pintrich, 2003). Among diverse types of motivation, the self-concept is mostly researched, perhaps due to its strong relationships with achievements (Marsh & Hau, 2004). The self-concept has (meta) cognitive, motivational, and affective characteristics in the "metacognitive and affective model of self-regulated learning" (the MASRL model) (Efklides, 2011).
The interest and value are part of motivation or affect in the MASRL model (Efklides, 2011). The two constructs are related to course or career choices (Cerinsek et al., 2013;Maltese & Tai, 2010). Although the interest and value share some commonality, if distinguishing them deliberately, the interest is a major part of intrinsic motivation in response to the subject per se (e.g., mathematics and science) or the temporary situation (e.g., pleasant learning materials and game-based learning) (Høgheim & Reber, 2015). The value, on the other hand, focuses on 'extrinsic motivation', responding to social appraisals (e.g., reputable colleges and higher-paid jobs) (Cerasoli et al., 2014). Therefore, these three constructs are the focused self-report motivation in this study.

Longitudinal Relationships of Motivation
The knowledge of longitudinal relationships within self-report motivation may provide insight into its longitudinal relationship with detected affect. Researchers on self-report motivation often use structural equation modelling (SEM) algorithms to examine their longitudinal relationships. The longitudinal relationships are normally stronger for the same motivation measures lasting over time (i.e., parallel paths) than for different affective states (i.e., cross paths). For example, prior interest and self-concept predict their respective later ones (parallel paths betas = 0.51 to 0.57) better than they predict each other (crosspath betas = 0.04 to 0/12) (Marsh et al., 2005). This pattern also occurs for students' prior digital learning preference, wish for digital schoolwork, and schoolwork engagement to predict their later ones over three years of middle school (parallel paths betas = 0.48 to 0.56) (Hietajärvi et al., 2020). The cross-paths from digital learning preference of previous years (grades 7-8) to predict the next years school engagement (years 8-9) are much smaller (cross-path betas = both 0.15) or non-significant.

Diverse Constructs of Detected Affect
The detected affect slightly corresponds to the emotional constructs (e.g., frustration) of affect in mathematical problem-solving (McLeod, 1994). In order to promote adaptive teaching, intelligent tutoring systems aim using diverse data sources and machine learning algorithms to (automatically) detect learners' affect.
The diverse data sources include learners' dialogues with online pedagogical agents, body posture through pressure (for the back and seat) on a sensor, user behavioural log-file data, human judges, and synchronous observation (D'mello & Graesser, 2007;Ocumpaugh et al., 2015). The machine learning techniques (e.g., feature engineering and predictive algorithms) normally map the physical, text, and logfile data to human judgment or observations to define and finally automatically detect affect. The detected constructs include the affect (e.g., anger, engaged concentration, and surprise) or behaviours (e.g., being off-task and gaming the system) (Baker & Rossi, 2013). D'Mello's (2013) the meta-analysis on affect, learning, and technology reveals that the most researched affective constructs are engaged in the concentration/flow, boredom, confusion, and frustration; besides, engaged concentration/flow, boredom, confusion are the most frequently occurring affective constructs, which also the focused detected affective constructs of this study.

Longitudinal Relationships of Detected Affect
Few studies investigate pure longitudinal relationships of detected affect. The studies to date appear to focus on linking detected affect to specific online learning systems or problem-solving contexts. For example, boredom reduces slightly from early to later online learning stages in a personalised, self-paced system. Engaged concentration leads to confusion when cognitive disequilibrium occurs, which further may link to frustration and then boredom (if a failure occurs), found by self-report methodology for online learning (D'Mello & Graesser, 2012). Confusion and frustration rise while studying worked examples, prompting students to correct, compare and explain errors (Richey et al., 2019). This leads to better learning gains, although confusion and frustration are negatively related to pre-test, post-test, or delayed post-test achievements in mathematics.

Longitudinal Relationships between Self-Report Motivation and Detected Affect
Relatively few studies focus on relationships between self-report motivation and detected affect. Following a similar research design to this study (pre-test motivation survey, one-year online learning (with detected affect), and post-test motivation survey), correlation analysis finds that self-concept relates to student learning outcomes and behaviours (e.g., correctness, completion time, and actions) more than interest and value (Slater et al., 2018). Another study uses middle school students' detected affect in the ASSISTments system to relate to their high-school self-report motivation (Ocumpaugh et al., 2016). Correlation analysis finds that STEM career self-efficacy positively relates to engaged concentration, negatively to confusion, and has no significant relationship with either boredom or frustration. STEM career interest has a negative correlation with confusion but non-significant correlations with engaged concentration, frustration, and boredom.
These studies appear to use correlational analysis only, failing to take into account time, which has been embedded in the data structure. This study aims to supplement this research gap by considering time as a structural issue examined by the SEM methodology.

Research Aim and Hypotheses
A special form of longitudinal relations is mediating effects. Mediating effects are popularly used in psychological research because mediating effects explain psychological phenomena focusing on processing (Chiu, 2022). Using the mediating effect methodology can partially assess the effectiveness of an intervention (e.g., the detected affect in online learning in this study). Three models, therefore, are formulated to examine the mediating effect. To explain using this study's measures and follow the conventional use of effect notations (Baron & Kenny 1986), a mediating effect is verified if meeting the following two conditions; 1.The later (post-test) motivation is impacted by its earlier (pre-test) motivation. In Figure 2, this is represented by the path c0 in Model 0.
Three popular algorithms to investigate mediating effects are regression (Shrout & Bolger, 2002), multilevel analysis (Kenny et al., 2003), and path analysis of SEM methodology (Preacher & Hayes, 2008). This study chose to use SEM because one single SEM analysis can obtain the three path parameters in the mediating models directly (i.e., A and B in the Models 1-2 of Figure 2).

Figure 2
The three hypothetical models

Model 2
Note. Model 0 is to set the scene that earlier motivation predicts the later motivation, for comparison with Model 1 and Model 2. Model 1 and Model 2 examine the mediating effect of affect on motivation change, the focus of this study.
Another reason for using SEM is that this study uses one mediator occurring at two time points (i.e., detected affect in fall and spring; Figure 2). Past studies normally use one mediator or several parallel mediators (Preacher & Hayes, 2008). Placing one mediator occurring at two time points allows an opportunity to investigate the following effects simultaneously.
4.Direct effects of prior motivation on spring affect (a3).
5.Mediating effects of spring affect from prior motivation to later one (a3*b2).
Effects 2-5 appear to be new in the literature.
Conceptually, this study aims to test the three models in Figure 2 for the different constructs of selfreport motivation and detected affect, separately.
Model 1 (concise model). Student affect over two phases (fall semester and spring semester) mediates the effect that early motivation predicts later one.
Model 2 (full model). The detected affect of both phases mediates the effect that early self-report motivation predicts later one.

Participants and Data Source
The participants included over 8,000 2nd-to 8th-grade students in the United States who used an intelligent tutoring system, Reasoning Mind, during the academic year of 2017-2018 (including fall and spring terms) (Ocumpaugh et al., 2013). All the users of the system were included and so no sampling methods were used. The students filled in an online survey about three motivational constructs (selfconcept, interest, and value). This study was not preregistered and was a secondary analysis of identified data, which were exempt from ethics committee review in both the countries of the original researchers and the author.
The system was designed for pre-K through grade 7 students to learn mathematics, utilizing a storybased curricular design and offering opportunities for a blended learning pedagogy. Teachers could use the system to provide students with self-paced, personalized learning experiences in a virtual city. A rewarding system provided students with game-based problem-solving experiences. A pedagogical agent guided students through the virtual city and learning processes. The learning modes in the system included guided study, solving additional related problems for mastery, collaborative games, and summative assessment. Students spent most of their time on guided study, with a sequence of mathematical objectives and problems of different levels of difficulty. Teachers could walk around the classroom to work with individual students or groups. The system also provided homework print for students to practice problems based on their prior achievements diagnosed by the platform.

Self-Report Motivation for Mathematical Learning
Students reported their motivations for mathematical learning on three scales (factors or constructs): self-concept (or concept), interest, and value. Each subscale has four items (Table 1). 3. I will need math to get into college. 0.587 4. I will need math to get the job I want. 0.645 Note. The scale for self-concept (or concept) is 1 = Not at all like me to 4 = exactly like me; the scale is reversed coded in the later analysis because all the items are negative wording. The scale for interest is 1 = Not at all like me to 4 = exactly like me. The scale for value is 1 = strongly disagree to 4 = strongly agree.
Students were surveyed at the start and end of the school year. As such, the measure names in this study are added a prefix "pre" to represent a pre-test measure (e.g., pre concept) and "post" to represent a post-test one (e.g., post interest). These measures are given in Table 2 in items 1-6.  (red) ones violate. The bold, italic (blue) means are different between two times in the same measure (e.g., preConcept is different from postConcept).
After the self-report scales were initially designed, exploratory factor analysis (EFA) and confirmatory factor analysis (CFA) were performed to select proper items. Using both EFA and CFA is a recommended practice for developing psychological scales (Morin et al., 2017). Participants' responses were coded to let higher scores represent higher degrees in the meaning of the constructs. Next, based on the EFA and CFA results, mean scores of the items belonging to the same factors were calculated and used to examine the hypotheses. The following describes the three phases of scale development.
Initial Design. Four subscales were initially developed on the basis of related literature (Marsh et al., 2005;Ryan & Ryan, 2005). In total, there were 18 items.
Self-concept had five items (e.g., "I would like math more if it wasn't so hard.") with a scale of 1 = Not at all like me to 4 = exactly like me.
Class interest had four items. Two problems asked for the importance of learning math (e.g., "How important is it for you to learn a lot in math classes?") with a scale of 1 = Not at all important to 5 = very important. Two problems asked for opinions (e.g. "How much do you look forward to math classes?" with a scale 1 = Not at all to 5 = very much. All items were deleted after item selection (the next section).
Domain interest had five items (e.g., "I enjoy working on math problems." Its scale is 1 = Not at all like me to 4 = exactly like me).
Value comprised four items (e.g., "Math will help me in my daily life.") with a scale of 1 = strongly disagree to 4 = strongly agree.
Exploratory Factor Analysis (EFA). EFA initially explored the likely factor structures of the 18 items using the pre-test data. A screen test revealed 3 to 4 factors were likely proper solutions. The 3-factor solution presented a more proper solution than the 4-factor solution after scrutinizing the 3-and 4-factor solutions and the original scale designs (Marsh et al., 2005). The reasons include that the 4-factor solution had one factor with only one item, but, in the 3-factor solution, each factor had 4 to 6 items with factor loading > 0.500.
Both interest and value only had 4 items with non-overlapping, larger-than-0.500 factor loading, and the same scaling method. To be consistent, the self-concept also contained four items, excluding one item with the lowest factor loading from the original five items. This procedure resulted in a self-reported motivational scale with 12 items in total (i.e., 4 items * 3 factors = 12 items).

Confirmatory Factor Analysis (CFA).
A CFA validated the 3-factor model (with 12 items) identified by the EFA using the post-test data. The fit indices revealed the 3-factor model was a good fit to the empirical data (χ2 (df) = 559.142 (51), p < 0.0005; RMSEA = 0.045; SRMR = 0.038; CFI = 0.964; and TLI = 0.953. (The "Data Analysis/Hypothesis testing" section presents the full name, meaning, and use of the fit indices in justifying a model fit.) The CFA factor loadings of the items for their respective factors are from 0.511 to 0.740 (Table 1). This study had a large sample size and all the factor loadings were larger than 0.500, the generally accepted size for factor loadings (Morin et al., 2017). The internal reliability coefficients (Cronbach's alpha) of the three subscales were 0.734 (self-concept), 0.741 (interest), and 0.715 (value). A Cronbach's alpha > 0.700 is mostly acceptable in the literature (Cortina, 1993). Overall, the self-reported motivational scale had desirable construct validity and internal reliability.

Detected Affect
A Machine Learning Procedure to Detect Online Affect. As a later development, the Reasoning Mind system introduced a procedure to detect students' affective states and behaviour online (Ocumpaugh et al., 2015). Trained coders observe students for up to 20 seconds and record students' affective states and behaviours on a synchronized device. Predictive algorithms, developed using standard cross-validation techniques, are developed to predict the observation records by features identified using online learning log data with feature engineering. Thus, students' online affective states and behaviours can be automatically inferred using online learning log-file data.
The use of the procedure as a labelling system in doing classroom observations has been used to successfully detect diverse types of student affective states. Ocumpaugh et al. (2013) find that the learning system is quite engaging, with students spending 66% in engaged concentration and dividing the remainder of their time (34%) between boredom, confusion, and frustration.
The Four Detected Affects. This study focused on four affective measures: engaged concentration, confusion, frustration, and boredom. The data were obtained from the automated affect detectors that were trained on the procedure with observations. The distribution percentages of affective states in the procedure with observations were: engaged concentration (65.9%), confusion (2.0%), frustration (1.1%), boredom (13.7%), and NA (17.3%). The distribution percentages in the new data from the automated detectors were engaged concentration (78.8%), confusion (31.1%), frustration (< 0.001%), and boredom (0.84%). Due to the extremely low incidence of frustration and boredom, the data for these two states were re-threshold to match the distribution of the procedure with observations. Accordingly, the top 1.1% and 13.7% of the affect predictions were marked as active for frustration and boredom, respectively.
As stated in the 'participants' section, this study used students' experiences of online learning in autumn and spring semesters. The mean scores of the four affective constructs for each student were calculated for each semester separately. As such, there were eight affective measures (= 4 detected affects * 2 semesters) in total. To give each measure a unique name in this study, the words "autumn" and "spring" were added for each detected affective construct (e.g., "Engaged Autumn" and "Confusion Spring"). Measures 7-4 in Table 2 present the names of the eight detected affect measures.

Data Analysis Data Preparation
Detected Affect Data. The initial dataset contained the four detected affect measures of 10,300,358 student actions at a 20-second grain size. The mean scores of the action-level measures formed their student-level measures for the fall and spring terms separately. Only 8,074 students have both fall and spring data, formed as a subset of data for further combination with the self-report motivation data.

Self-Reported Motivational Data.
The survey dataset contained 377,856 answers (209,610 for the pretest and 168,246 for the posttest). The answer-level dataset was transformed to a student-level one for the pretest and posttest separately. Only students with both posttest and posttest were retained (i.e., by inner join), resulting in a subset of data of 5,435 students. This dataset was used for EFA and CFA to determine the final items used in this study (Table 1). Detailed EFA and CFA procedures are presented in the Method/Measures/Self-report motivation section.

Combining Affect and Motivation Data.
The datasets generated from the automated affect detectors and self-reported measures were combined using an inner join. This procedure selected a student sample that had affect data in both the autumn and spring semesters and motivation data in both the pre-test and post-test. The final dataset contained 792 students for later data exploration and analysis.

Data Exploration
Pearson correlation explored simple relationships between all the measures (Hypothesis 1). Because many correlational tests were simultaneously performed, Benjamini-Hochberg procedure was performed to correct multiple comparisons (Benjamini & Hochberg, 1995).

Hypothesis Testing
Path analysis with mediating effects using SEM methodology examined the mediating effects of detected affect on self-report motivation. Figure 2 presents the detailed models examined. Generally, evaluating model fit to empirical data in SEM methodology applies multiple indices. Typically, used indices and criteria include the root-mean-square error of approximation (RMSEA) < 0.080, standardized root mean residual (SRMR) < 0.080, comparative fit index (CFI) > 0.900, and Tucker-Lewis index (TLI) > 0.900 (Hair et al., 2010). That is, for both RMSEA and SRMR, a smaller value indicates a better model fit, while for both CFI and TLI; a larger value indicates a better model fit. A traditional index but rarely used one is a non-significant chi-square (χ2), because a significant χ2 would be easily obtained if the sample size is large (Bollen & Long, 1993). As a convention, this paper would present χ2 and its related statistics. The reason is that most highly used criteria (e.g., RMSEA, CFI, and TLI) use χ2 as a base to adjust themselves such as by sample size, degree of freedom, and penalty for a complex model (Chiu, 2020).
Model 0 and Model 2 are just-identified or saturated models, which have the same number of free parameters as the total number of path coefficients and measure variances. This will create a zero degree freedom (Raykov et al., 2013). As such, all the fit indices, as described in the previous paragraph, cannot be obtained. Even with this, the path coefficients obtained for just-identified models are still trustworthy (Heyder et al., 2017).

Data Exploration: Paired T-Test and Correlations
Paired t-test examines whether differences occur between the same motivations or affect measures over two time periods. The results reveal that students change their motivations and affects over time, except for value and frustration (Table 2). This may serve as an additional reason for using the posited model ( Figure 2) to address the changes in motivation and affect in the academic year.
Pearson's correlations in Table 2 explore the bivariate relationships between all the measures. The results reveal that the measures of the same valances (either positive or negative) and the same measures obtained in two times (e.g., interest in pre-test and post-test; frustration in fall and spring) are positively correlated for both motivation and affect measures, separately. There are, however, low correlations between self-report motivation and detected affect. Motivation. Self-concept, interest, and values are positive-valence constructs. All three constructs are significantly, positively correlated, except for three non-significant ones (Table 2). Generally, the highest correlations occur between the pre-test and post-test for all three motivation measures: self-concept (r = 0.501), interest (r = 0.594), and value (r = 0.415).
Affect. Engaged concentration is the only positive-valence affect. Engaged concentration has negative correlations with the other negative-valence affect measures (confusion, frustration, and boredom; Table  2). The three negative-valence affect measures are positively correlated with each other, except for two non-significant correlations. Positive correlations occur for the same affect detected at different times (e.g., positive correlation between boredom in fall and that in spring).

Motivation and Affect.
The correlations between motivation and affect are very low (-0.199 to 0.099; Table 2) and only 12 out of the 48 correlations are significant. Self-concept is negatively correlated with negative-valence affect measures, though with many non-significant correlations. Interest generally has non-significant correlations with affect; all of its significant correlations violate the general principle of positive correlations between same-valence measures (e.g., -0.092 pre interest with engaged autumn) and vice versa (e.g., 0.099 post interest with confusion spring). No significant correlation occurs for value.   Note. Bold (red) figures indicate their direction and significance violate predictions. χ 2 = chi-square (or minimum function test) statistic; df = degrees of freedom; RMSEA = root mean square error of approximation; SRMR = standardised root mean square residual; CFI = comparative fit index; TLI = Tucker-Lewis index.

Model Fit Evaluation
Due to some undesirable fit index values for Model 1 (the concise mediating effect from a particular affect over two phases), the following only focuses on the results based on Model 2 (the full mediating effects via the both phases affect). Besides, Model 2 provides more mediating effects, as addressed in the next section, than Model 1. Table 4 presents the path coefficients based on Models 0 and 2.

Mediating Effects Examination 1: Inferred Mediating
A criterion for a mediating effect is the effect of a motivation from pre-test to post-test (Model 0) reduces when including mediators (Model 2), using this study as an example (cf. The Present Study). That is, a mediating effect occurs if c0 in Model 0 is larger than c2 in Model 2 (i.e., c0 > c2; Figure 2) although a direct multiplication of several related relationships is also an indicator (e.g., a2*b3, Table 4).

Mediating Effects Examination 2: Direct Mediating
The direct effects between motivation and affect (based on a2 and a3; Model 2 of Figure 2) slightly objectivise the above inferred mediating effects (mainly based on c0 and c2). This emerges as a direct measure of a mediating effect obtained by multiplying all the effects relating to one mediator in its related paths. (Model 2 in Figure 2 shows the related paths.) The only significant mediating effect is the model for interest mediated by engaged concentration in fall (a2 b3 = -0.092 -0.126 = 0.012). This result implies that engaged concentration in fall mediating the effect of self-concept from pretest to post-test is the most salient mediating effect in this study.
Interest has three direct predictive effects (Table 4). Pre-test interest negatively predicts engaged concentration in fall (a2 = -0.092), which further negatively predicts post-test interest (b3 = -0.126). Pretest interest positively predicts confusion in spring (a3 = 0.079). Value has no significant direct effect on any detected affect.

Longitudinal Development within Motivation and Affect
Among the three motivation constructs, interest has the largest path coefficients from pre-test to post-test (0.584 to 0.594), followed by self-concept (0.496 to 0.504) and value (0.414 to 0.416; c2 in Table  4). The results imply that the degrees of stability of the three motivation constructs over time are the selfconcept, the interest, and the value, in descending order. (Similar trends occur in Model 0.) Among the four affect measures, engaged concentration has the largest path coefficients from fall to spring (0.716 to 0.720), followed by boredom (0.508 to 0.526), confusion (0.436 to 0.442), and frustration (0.301 to 0.316), in descending order (d2 in Table 4). The results also imply the degrees of stability among the four affect measures over time.

The MAR model
This study posits the MAR model ( Figure 1) as a theoretical basis with a reference to related SRL theories (Baars et al., 2017;Efklides, 2011). The MAR model highlights the reciprocal relationship between motivation and affect as part of the SRL process. The results support the MAR model for specific pairs of motivations and affects (Table 4) in terms of mediation effects as evidence of regulation. The most salient mediation effect occurs for the pair of interest and engaged concentration. The MAR model is partially supported for self-concept and is completely not supported for value. Stable effects are found for the same motivations and affects over time. All these are addressed in detail as follows.

Few but Unique Mediating Effects of Affect on Motivation
The unique contribution of this study is the mediating effects of affect on motivation using longitudinal data and SEM predictive methodology. The results reveal that the full mediating model (Model 2 in Figure 2, where the affects in both phases mediate the effect that early motivations predict later ones) fits empirical data properly for diverse types of motivation and affect. (cf. Model 1 fails to fit empirical data for some types of motivation-affect pairs).
The significance and direction of the mediating effect from affect are different among the three motivation measures. Interest's mediating effects from affect are most salient, unique but explainable (e.g., engaged concentration in Figure 3-A). For the self-concept, the most significant mediating effects are from a negative-valance affective construct in a negative direction, an unsurprising result (e.g., frustration, Figure 3-B). The value has no mediating effect.

Figure 3
Example path coefficients

Example B. The Self-Concept and Frustration Model
Note. The underlined path coefficients are not significant at p < 0.05.

Interest
The most salient mediating effect is engaged concentration, mediating interest from the pre-test to the post-test. However, this mediating effect is unique in its patterns. The path from pre-test interest to engaged concentration in the fall is negative, and the path from engaged concentration in the fall to posttest interest is also negative. This overall mediating effect is significant in positivity. A closer look at engaged concentration in the spring finds that the paths leading to and leaving from it are both positive, though non-significant. This result suggests that interest's negativity in engaged concentration only occurs in the early stage. In a later stage of online learning, interest will gradually lead to engaged concentration. To add another mediating effect, interest leads to confusion only in a later stage (spring).
The interest is a motivation construct relating to science career choices (Cerinsek et al., 2013;Maltese & Tai, 2010). In order to explain the unique finding, we need to delve into the essence of 'interest.' The interest includes both subject-matter interest and situational interest (Høgheim & Reber, 2015), with situational interest being related to engaging in tasks but not to achievement (Zhu et al., 2009). Even though this study uses self-report 'subject-matter' (mathematics) interest items (Table 1), the unique pattern of mediating effects from disengagement and confusion suggests interest is sensitive to learning format (or situation) changes (e.g., between traditional and online learning).
For educational practices, teachers need to be aware that students interested in mathematics may experience initially less engaged concentration but lately (with confusion) in online mathematical problemsolving. Confusion is a sign of good or improved learning (Richey et al., 2019). The reason for this may be that the differences between traditional paper-and-pencil and computer-supported learning formats matter for students who are interested in mathematics. More support in learning format changes is needed for students interested in the traditional format of learning mathematics (e.g., manipulatives, drawing, and paper-and-pencil). An online system design simulating traditional mathematics teaching or learning environment (e.g., virtual reality, diverse hands-on activities, and creative arts) may also be a solution. These speculations are worth future research.

Self-Concept
Self-concept in mathematics is consistent with affect detected during online mathematical learning. This is evident in the self-concept's multiple negative paths with the negative-valence affect. The most salient affect is frustration. Students initially perceiving high self-concept in pre-test are less frustrated in both fall and spring. This is also true for boredom and for initial confusion, although the mediating effect is not salient (without reduced path parameters from pre-test to post-test self-concept).
The results concur with most scholars' emphasis on self-concept (confidence) for persistence and action taken (Burton, 2004). Another reason for the results may be that self-concept is more highly related to achievements than all other motivation measures (Chiu, 2018;Marsh & Hau, 2004). Achievement may be one of the major sources of motivation and affect (Marsh & Hau, 2004). Future research needs to validate this speculation further by incorporating achievement. For education practice, the self-concept can prevent students from the negative affect of online learning lasting for a long time (e.g., over two semesters in this study). Cultivating the self-concept appears to benefit students in both traditional and online learning formats.

Value
Unlike the other two motivational constructs (the self-concept and the interest), the affective states did not significantly mediate the relationship for value. A direct reason for the finding is that value is not mediated by online affect. Another reason may be that the items of value focus on 'extrinsic motivation' (Cerasoli et al., 2014). Extrinsic motivation relates learning mathematics to the outer world (i.e., to help life, learn other subjects, enter college, and get jobs; Table 1), not inner value (or interest) (e.g., I enjoy working on math problems).
The research has indicated that extrinsic value or motivation is related to social norms and authorities in students' lives (Chiu, 2017). The affect experiences detected through online learning may be more likely to mediate or reflect students' inner-oriented motivations (e.g., self-concept and interest) than their extrinsic value. This speculation still needs to be validated, perhaps by incorporating measures of related social norms or authorities.

Stable Longitudinal Development of Motivation and Affect
For each specific measure, both motivation and affect are relatively stable. That is, pre-test motivation predicts later motivation; the affect in fall predicts that in spring. Specifically, the degrees of stability for motivation over time are self-concept, interest, and value, and those for affect are engaged concentration, boredom, confusion, and frustration, in descending order. The findings are consistent with past research findings that early motivation (e.g., self-concept and interest) predicts later one (e.g., Marsh et al., 2005). Past research on affect also provides partial evidence. More empirical studies need to validate these findings, especially for affect and for the differential degrees of stability over time between different constructs.
For educational practices, the findings suggest a stable, long-term quality of motivation and affect. This calls for a need for earlier interventions to promote desirable motivation (e.g., confidence and interest) and affect (e.g., engaged concentration).

Conclusion and Implications
The MAR Model is evidenced by mediating effects of the affect on motivation. To date, very few studies focus on relationships between the self-report motivation and the detected affect. This study posits the MAR model to address this issue. The results based on empirical datasets find that earlier self-concept can be mediated by fewer frustrations in online learning and lead to later self-concept. Interest triggers early disengagement and late confusion during online learning. Value is not mediated by affect.
SEM is used for longitudinal experimental design. When data is collected longitudinally, it is suitable to use predictive algorithms. SEM with mediating models offers opportunities to investigate more complex relationships when common measures are collected across time.
The findings of this study offer implications for pedagogical and online learning system designs. Both offline pedagogical designs and online learning system designs need to consider the gaps between different formats of learning. Students with a high interest in learning mathematics in real classrooms may fail to adjust themselves easily to online mathematical problem-solving and experience disengagement in the early stages (one semester) and confusion in the later stages (after one semester). Future research may investigate the effectiveness of different types of support for students in traditional and online learning formats.

Limitations and Suggestions for Future Research
Parsimony is a desirable characteristic of theories. This study finds a full-path model (Model 2) fits empirical data more properly than a concise model (Model 1). Even though a full-path model may reflect the fact, a more complicated model (including measures such as computer-assisted learning preference, learning styles, gender, and school) with reduced paths may be a solution to build a parsimonious model by future research.
"The affect" is a complex term with different meanings in different academic fields. This study uses a specific methodology in order to investigate relationships between related constructs in two major fields (educational psychology and technology). Unifying related constructs in different fields is a challenging task because even for the same field, affective constructs are not equivocal and orthogonal. For example, engaged concentration has a high correlation with boredom ( Table 2). The commonality and differentiation between different types of affect and motivation assessed or detected using different tools over time remain an interesting issue to address in future research. Perhaps the first step is to develop the paper to synthesise past related studies by systematic review or meta-analysis, simultaneously suggesting methods to solve this complex issue.
This study examines the mediating role of detected affect (occurring during online learning) only. Potential mediators exist. For example, the achievement may mediate motivation (or affect) changes given the stable relationships between motivation and achievement. The MAR model may benefit from adding the achievement for its further elaborated, thorough the model.

Data declaration
The initial datasets are not publicly accessible, but available to researchers upon request to Penn Centre for Learning Analytics (https://www.upenn.edu/learninganalytics/geniemail.html). The data were from the original researchers in fully identified form, which fits under the category of secondary analysis of identified data and is exempt from ethics committee review, category 4-ii, in the USA. Secondary analysis of identified data is also exempt from ethics committee review in Taiwan (the author's country).