Mathematics and statistical skills are crucial to daily life. However, many students found mathematics difficult to learn and understand. This research aimed to find relationships between mathematics and statistical attitudes and emotional dimensions, such as anxiety or self-efficacy. The sample consisted of two groups: the first group was formed by 276 Spanish students (75.7% female with an average age of 19.92 years) from different degrees at the University of Granada and the second one by agroup of 19 secondary school students from of a Secondary School in Granada, Spain (57.9% male students between 14 and 16 years of age from a public school). The instruments applied were a scale of attitude toward mathematics, a scale of attitude toward statistics, a scale to assess mathematical anxiety, and a scale to assess self-efficacy. An artificial neural network for the backpropagation algorithm was designed using dependent variable. The results showed a negative impact of anxiety on those attitudes, while self-efficacy had a positive impact on those mentioned attitudes. Therefore, emotional education is important in the well-being, and teaching in mathematics. The usefulness of the innovative neural network analysis in predicting the constructs evaluated in this study can be highlighted.