1 Introduction

The new global consumption patterns have caused an increased demand for animal protein production, according to the Global Pork Market Report 2017–2021 (Reportlinker 2017), resulting in higher water consumption and, consequently, higher volumes of effluent with high concentrations of nutrients and organic matter (Cheng et al. 2019; Cheng et al. 2018).

In order to mitigate the environmental impacts of pig farming, different technologies for wastewater treatment are evaluated, such as the use of upflow anaerobic sludge blanket reactor (UASB) (Lettinga et al. 1980), which has advantages in reducing the energy consumption and operating costs, considerable removal of organic matter, low hydraulic retention time (HRT), and generation of more stabilized sludge (H. Yang et al. 2019).

However, due to the operational, physicochemical, microbiological characteristics (Hu et al. 2018; Lettinga et al. 1980), UASB reactors generate wastewaters still with high concentrations of organic matter and, mainly, nutrients such as nitrogen and phosphorus, requiring post-treatments. In this context, the submerged aerated biological filters (SABFs), with characteristics of high biological retention time through the development of biofilms (Abou-Elela et al. 2019), and horizontal subsurface flow constructed wetland (HSSF-CW) systems, characterized by support-plant-microbiota interactions, are treatment units reported as competitive and alternative of treatment (Oliveira et al. 2020; Matos et al. 2018).

The nutrient removals by biological reactors may vary depending on different characteristics, such as organic matter concentrations, biodegradability performance, hydraulic retention time, type of support medium employed and cultivated species used (Kasak et al. 2018). More than that, a wide range of monitoring parameters intrinsic to climatic and operational conditions can also interfere in treatment plants (Platikanov et al. 2014).

The use of multivariate statistics is presented as a tool used to provide better spatial and temporal relationships in order to facilitate a better understanding of the wastewater quality (Enitan et al. 2018). Among them, Pearson’s graphical correlation analysis is a statistical method that assesses the degree of relationship and the intensity between the variables, being perfect relationship closer to + 1 or − 1 (Babu et al. 2014). Although useful, correlation analysis sometimes leads to a large number of variables that are difficult to examine, so principal component analysis (PCA) and hierarchical cluster analysis (HCA) can optimize interpretation (Cristóvão et al. 2016).

In recent years, multivariate statistical methods of PCA and HCA have been applied in wastewater studies to investigate the complex structure underlying many analytical data, reducing the data sets to some significant variables, factors, or components, without losing significant information (Bayo and López-Castellanos 2016).

Currently, researchers have used PCA and HCA to determine the correlation between process variables and characterize the quality of surface water and wastewater, as noted by Bayo and López-Castellanos (2016), who found six factors with 71.43% of the total variation of the original data, and Dacewicz and Chmielowski (2019), who found that the reduction in COD in treated domestic sewage was the main factor that determined the affiliation to the data clusters.

This study was developed to evaluate the efficiency and the factors involved in the removal of forms of nitrogen and phosphorus in integrated biological reactors UASB, SABF, and HSSF-CW planted with Tifton 85 grass in the treatment of swine wastewater, applying research and comparison multivariate statistical methods of principal component analysis (PCA) and hierarchical cluster analysis (HCA) and conventional descriptive analysis for the measured data. The need for the study arose from the increase in the production of swine wastewater volumes, followed by higher operating costs for monitoring SW in Brazil, a country with the largest swine herd in Latin America and with strong single-family characteristics. In this way, the study can contribute to the double objective of enabling the reduction of financial costs, reducing the periodicity of the analysis of medium and small producers, maintaining the significant degree of the original information, and reducing the release of nitrogen and phosphorus in rivers, preventing the emergence or intensification of eutrophication.

2 Materials and Methods

2.1 Location and Description of the Sequential Treatment System

The study was carried out in an experimental area of the Department of Water Resources and Sanitation at the Federal University of Lavras (UFLA) in Lavras, Minas Gerais, Brazil, latitude 21° 13′ 45″ S, longitude 44° 58′ 31″ W, average altitude of 918 m and Cwa climate (mesothermal or tropical altitude), with dry winter and rainy summer, according to the Köppen classification (Sá Junior et al. 2012). The biological treatment system consisted of three reactors installed sequentially and developed for the removal of organic loads and nutrients from swine wastewater (SW), being the following: upflow anaerobic sludge blanket reactor (UASB), biological filter submerged aerated (SABF), and horizontal subsurface flow constructed wetland (HSSF-CW).

The useful volume of the UASB reactor is 0.016 m3 and a sewage sludge wastewater treatment plant (WWTP) was inoculated at UFLA, presenting approximately 38 g L−1 of VTS to determine an initial load of biological organic matter of 0.10 kg kg−1 day−1, represented by the ratio (COD) (VTS)−1 (day)−1 established by Chernicharo (2007). The SABF aerated reactor was filled with plastic construction material (PVC electrical conduit) due to its structural characteristics and low commercial cost; in addition, it had an average air supply ranging from 4.0 to 6.0 L min−1 (Oliveira et al. 2020). The HSSF-CW unit, capable of removing nutrients from swine wastewater, was installed as an integrated after-treatment for the UASB anaerobic and SABF aerobic reactor. It was built in a high quality polyethylene structure, filled with gravel No. 1 and a useful volume of 47 L, voids between 47.4 and 47.9% and planted with Tifton 85 grass (Cynodon ssp.). All structural and operational characterizations of the reactors followed the protocols recommended by Oliveira et al. (2020) and Chernicharo (2007).

2.2 SW Untreated Sampling and Schematic Structure of Treatment

The supply of swine wastewater (SW) was obtained from a full-cycle pig farm, which ranges from maternity to obtaining a piglet weighing between 85 and 105 kg. The collection of untreated SW was performed every 2 weeks and subjected to preliminary treatment with a sand sedimentation tank and static sieving. Figure 1 shows a schematic structure with the reactors used in the study.

Fig. 1
figure 1

Schematic structure of the reactors. Point P1 influent of the UASB; point P2 effluent of the UASB and influent of the SABF; point P3 effluent of the SABF and influent of the HSSF-CW; and point P4 effluent of the HSSF-CW

2.3 Quality of Influent Swine Wastewater and Operational Parameters

The quality characterizations of the swine wastewater (SW) were carried out at the beginning of each weekly monitoring. Table 1 shows the SW operational and quality parameters applied to the system, while in Fig. 2 the climate monitoring data at the site of the experimental installation, obtained by the meteorological station of the National Institute of Meteorology of Brazil, are presented (INMET).

Table 1 Quality characteristics of swine wastewater and of the operational system in four phases monitoring
Fig. 2
figure 2

Behavior of room temperature (T) (a), relative humidity (RH) and rainfall (P) (b) throughout the monitoring

2.4 System Startup and Evaluated Variables

The system monitoring started in October 2017 and the sampling of all collection points occurred twice a week, at 07:00. The system was subjected to four rates of organic load (each load is associated with a phase of the study), which comprised 1, 2, 3, and 4 kg m−3 day−1 of COD during 163, 136, 77, and 44 days, respectively, totaling 420 days. The greater number of days in the initial phase promotes microbiological adaptation and stabilization of biodegradable organic matter, reducing the days to obtain the COD balance at the end of the other phases, even with the increase in the organic loads applied in the project.

Twice a week, the values of hydrogen potential (pH) (4500-H+) and electrical conductivity (EC) (2520-B) were determined by potentiometric method; total phosphorus by the ascorbic acid method (4500-PE using digestion with acid from the Marconi digestor block (Micro - MA 850/16) and Hach DR-4000U spectrophotometer); total kjeldahl nitrogen (TKN) using Marconi digester block (Macro - MA 850/16) and Marconi MA-036 distiller, analyzed by the 4500 Nitrogen method; nitrite nitrogen (NO2 - N) by the 4500- NO2 method (Rice et al. 2017); and nitrogen nitrate (NO3 - N) by the method of Yang et al. (1998).

2.5 Statistical Analysis

The boxplots of the analyzed variables were developed for graphic evaluation. For conventional statistical analysis, analysis of variance (F > 0.05) was applied, and the significant results were submitted to the Tukey test to identify the homogeneous type of data sets using the Sisvar® software (Ferreira 2011).

The swine wastewater quality (SW) data were applied to Pearson’s graphical correlation matrix with significance levels for the variables analyzed, using the R programming language, using the Performance Analytics package (Peterson et al. 2018; Core Team 2015). For this procedure, the data were standardized according to the variability of units and amplitudes. To understand the complexity and the effect of the graphical correlation matrices, the significant or non-significant results were analyzed according to the classification criteria proposed by Hopkins (2016), being very low (0.0 < r ≤ 0.1), low (0.1 < r ≤ 0.3), moderate (0.3 < r ≤ 0.5), high (0.5 < r ≤ 0.7), very high (0.7 < r ≤ 0.9), and extremely high (0.9 < r ≤ 1.0).

In this research, the principal component analysis (PCA) was used to investigate the treatment reactors and the factors that influence the removal of nutritional parameters from the quality of swine wastewater, providing a reduction in the dimensionality of the original data and production of main components with significant representativeness (Oliveira et al. 2020; Verma and Suthar 2018; Gamble et al. 2012). The vegan package with varimax rotation and Kaiser normalization in the R programming language was used to run the PCA (Core Team 2015), providing independence and effective reduction of the data matrix (Oliveira et al. 2020). The suitability of the data for application of the APC was assessed by Kaiser-Meyer-Olkin (KMO) tests (Kaiser 1974) and Bartlett’s Sphericity (Tobias and Carlson 1969).

The KMO is a measure of sample adequacy that indicates the proportion of variation caused by the underlying principal components, with a higher value close to 1.0 generally indicating that the data set can be used for PCA (Oliveira et al. 2020; Tripathi and Singal 2019); however, if the KMO test value is less than 0.5, the data set is not suitable for the application of PCA (Fávero et al. 2009). In addition, Hutcheson and Sofroniou (1999) classify the KMO test as insignificant (values between 0.5 and 0.7), good values (between 0.7 and 0.8), and optimal values (above 0.8).

Bartlett’s test assumes two premises: (1) Bartlett’s Sphericity test examines whether the correlation matrix is an identity matrix; in this case, if the correlation matrix is an identity, all variables are not related, making the PCA inadequate. The null hypothesis of the Bartlett test assumes that the correlation matrix is an identity matrix (there is no scope for reducing dimensionality); (2) on the other hand, the significance level below 0.05 rejects the null hypothesis and indicates that there are significant relationships between the parameters (Tripathi and Singal 2019). The PCA factorial loads were evaluated according to the criteria proposed by Soares et al. (2003) and Verma and Suthar (2018), with loads close to ± 1 indicating a strong correlation between a variable and the factor, and variables that exhibited a load weight > 0.3 were significant.

Hierarchical cluster analysis (HCA) is a multivariate approach that aims to identify clusters between objects in a data set, minimizing variation within the cluster and maximizing variation between clusters (Kaufman and Rousseeuw 1990). In this sense, HCA was used in this study to determine the similarity between swine wastewater samples using Ward’s method groupings (with Euclidean Distance applied as a dissimilarity criterion) by the XLSTAT 2016 (Addinsoft 2016).

3 Results and Discussion

3.1 Quality of the Influents and Effluents by UASB, SABF, and HSSF-CW

The results with the amplitudes and data ranges of influent and effluent pH, EC, TKN, PT, NO3 - N, and NO2 - N from the biological reactor system integrated in the treatment of different organic loads of swine wastewater for 420 days can be seen in the graphs of the boxes in Fig. 3 a, b, c, d, e, and f. Complementing these data, in Supplementary Table S1, the statistics of the means of each variable in the respective phases are represented.

Fig. 3
figure 3

Box plot of pH (a), electrical conductivity (EC) (b), total nitrogen kjeldahl (TKN) (c), total phosphorus (PT) (d), nitrate nitrogen (NO3 - N) (e), and nitrite nitrogen (NO2 - N) (f); 1: P1 influent of the UASB; 2: P2 effluent of the UASB and influent of the SABF; 3: P3 effluent of the SABF and influent of the HSSF-CW; and 4: P4 effluent of the HSSF-CW

The range of variation of pH, effluent, and affluent of each reactor presented medians between 7.1 and 8.0, observed in points 4 and 3 and respective phases I and II (Fig. 3a), thus remaining with values within the range. From 6.0 to 9.0 throughout the experimental period, this interval is adequate to maintain microbial stabilization of organic matter (Metcalf 2003), although the ideal condition for the performance of anaerobic digestion and the consequent conversion of matter organic methane occurs in the range of 6.8 to 7.4 (Chernicharo 2007).

In the SABF and HSSF-CW reactors, the greatest variations occurred between the maximum and minimum pH values (points 3 and 4 in phases I and III), providing more intensely the dynamics of nitrification—denitrification and reduction of the interquartile ratio in the pH values (Fig. 3a)—resulting in statistically different means between points 1 and 4 in phases I, II, and IV (Supplementary Table S1). However, if a significant difference was observed between the pH values between the reactors, the same did not occur when comparing the values in each phase, demonstrating maintenance of the pH in the influential treatment system.

An increase was found in the medians of the EC of the effluent, in the UASB reactor, in relation to the affluent, with increments of 0.9 to 2.9 dS m−1 in phases I and IV, respectively (Fig. 3b). This condition, in addition to being caused by the increase in the applied load, also occurs due to the stabilization of several compounds, mainly organic acids, increasing the concentrations of solids and salts dissolved in the medium by mineralization (Goddek et al. 2018). In the passage of the SW through the SABF and HSSF-CW reactors, there was a decrease in the EC values in all phases and interquartile range (Fig. 3b), resulting in average values in phase IV between 2.2 and 1.7 dS cm−1 in the SABF (P3) and HSSF-CW (P4) effluent, respectively, as shown in Supplementary Table S1.

Similar results of EC reduction were obtained by Porwal et al. (2015) in an aerated reactor for the treatment of dairy wastewater, which was higher than 16% (0.53 dS m−1 effluent) and 19% (0.52 dS m−1 effluent) of removal in HSSF-CW grown with Cyperus papyrus and Phragmites australis, respectively. The stabilization capacity of organic compounds is associated with continuous supply and adequate concentrations of dissolved oxygen in aerated reactors, which optimizes the microbial growth capacity and the performance in the use of ions produced in the medium produced as SO42−, CO32−, HCO3, and K+ (Parakh et al. 2019), in addition to influencing the pH and the nitrification dynamics of the medium.

While in HSSF-CW, EC removals can occur by the assimilation of ions by Tifton grass and by the cationic adsorption mechanisms and change with the support medium, since there is an interaction between positive ion charges in wastewater, such as calcium, magnesium, and potassium with negative charges in the support medium (filter medium or roots) (Matos et al. 2018; Fia et al. 2017).

The box plots in Fig. 3 c and d highlighted an increase in TKN and PT concentrations, respectively, as the applied load increased. It was also possible to verify that, as observed by Lim and Kim (2014), anaerobic reactors are not effective units in removing nutrients, which is why there was no significant difference between the TKN concentrations between the influential and the effluent. Regarding PT, only in phase II, the treatment was effective (Supplementary Table S1). On the other hand, in the SABF and HSSF-CW reactors, concentration reductions were found, mainly due to the presence of oxygen and nitrifying and denitrifying bacteria (Abou-Elela et al. 2019), obtaining maximum efficiencies of 48.9 and 68.0% of TKN in phase IV and 26.1 and 41.0% of PT in phase II, respectively, in the SABF and HSSF-CW reactors.

Although nutrient removals in the HSSF-CW are generally in the range of 40 to 60% PT and 40 to 50% N (J. J. S. a. b. Vymazal 2017), the autors J. Vymazal and Kröpfelová (2008) concluded that most N removal is reduced when compared with the removal of organic load and solids, a condition associated with the reason of a predominantly anoxic/anaerobic environment with aerobic microzones, and cannot provide simultaneous conditions for nitrification and denitrification, configured as one of the main routes of N removal in the HSSF -CW (He et al. 2016).

In an overall analysis, after 420 days of monitoring and final loads applied to the HSSF-CW of 80.0 and 67.2 kg ha−1 day−1 of TKN and PT, respectively, the integrated system presented final concentrations of 29.6 and 59.9 mg L−1, efficiencies of 87.5 and 63.1% and loads removed of 70 and 42.4 kg ha−1 day−1 of TKN and PT, respectively. The results found were higher than the mean of 40% of TKN obtained by (Fia et al. 2017) after an applied load of 111 kg ha−1 day−1 of TKN via swine wastewater in HSSF-CW, probably due to the decreased in the contribution of nutrients, as the plants have limited absorption capacity, the same reason why authors did not observe a significant difference in removal in relation to the control unit (without plants). The efficiencies were also higher than those reported by Lutterbeck et al. (2018) who found removals ranging from 57.7 to 28.4% of TKN and PT, respectively, in an integrated system UASB - Biological Filter - HSSF-CW cultivated with Hymenachne grumosa and treating domestic sewage under inlet load of 1.79 kg ha−1 day−1 of COD; in addition to the applied load, other factors are of great importance, such as the type of plant species chosen. Other factors that also interfere with the removal of nitrogen forms are the type of flow, the number of stages, and the redox conditions (J. J. W. Vymazal 2010).

The measured concentrations of nitrite nitrogen (NO2 - N) and nitrate nitrogen (NO3 - N) in the effluents and effluents from the UASB reactor showed extremely low averages (< 0.2 mg L−1), resulting from the absence of oxygen and specific bacteria for conversion, mainly from the ammonium ion to more oxidized nitrogen forms (He et al. 2016). In subsequent units, it was possible to observe greater activity of nitrifying and denitrifying bacteria.

In the SABF used as post-treatment for the UASB reactor, the concentration of dissolved oxygen remained between 4.5 and 6.9 mg L−1, a favorable condition for nitrification, while for the interaction between anaerobic, anoxic, and aerated environments (microzones in the rhizosphere) in HSSF-CW, it optimized the dynamics of N removal (nitrification/denitrification). Growth in effluent concentrations in the SABF reactor 7.9 to 18.0 mg L−1 of NO3 - N and from 2.9 to 73.4 μg L−1 of NO2 - N between phases I and IV, respectively, were found (Fig. 3 e and f), resulting in significantly higher averages in all phases. The concentrations of the measured nitrite and nitrate data are associated with an abundance of nitrifying bacteria, such as ammonia oxidizing bacteria (Zhang et al. 2019). More than that, transformations of nitrogen compounds can also influence the increase in organic loads and change the pH of the medium.

The reduction in concentrations and interquartile distances for NO2 - N and NO3 - N (HSSF-CW) effluent (Fig. 3 e and f) is observed at point 4, greater median of 26.8 μg L−1 occurring in phase II and of 6.5 mg L−1 at the end of 420 days of monitoring, respectively. Except for phase II, the concentrations of NO2 - N and NO3 - N found in the HSSF-CW effluent were low (Supplementary Table S1) and with efficiencies of 86.2 and 82.9% in phase IV, respectively, indicating that the mechanisms of nitrogen removal in the HSSF-CW, mainly denitrification, nitrification, and nitrate absorption by cultivars (H. Yang et al. 2019; He et al. 2016; Fia et al. 2017), were achieved effectively. More than that, research states that the dynamics of nitrogen and phosphate forms can still be strongly altered due to increased organic loads and maintenance of HRT (Almeida et al. 2017), increased C/N ratio (COD/TKN) (He et al. 2016), HSSF-CW clogging (Matos et al. 2018), and species, polycultures plant density (Leiva et al. 2018).

The removal of PT occurs mainly by adsorption in the support medium and precipitation and absorption by cultures, being that the previous mechanism tends to decrease during the period of operation, due to the saturation of the binding sites (Lan et al. 2018). Thus, in addition to the applied load, the reduction in the retention capacity by electrostatic forces can also explain the increase in PT concentration in the phases.

3.2 Graphical Correlation Analysis

The interaction between the original variables and their respective effects in the treatment units (Fig. 4 a, b, and c) provided correlation matrices expressed by histograms with data distribution on the main diagonal, bivariate dispersion of data, associated and correlated values by Pearson, and meaning levels on the upper diagonals.

Fig. 4
figure 4

Pearson graphical correlation matrix with significance levels for the variables pH, EC, TKN, PT, NO2 - N, NO3 - N, and COD/TKN in the UASB (a), SABF (b), and HSSF-CW reactors (c) over four organic loads. Each significance level is associated to a symbol: p values 0.001 (three asterisks), 0.01 (two asterisks), 0.05 (one asterisk), and 0.1 (upper dot)

In the UASB reactor (Fig. 4a), the pH effects on the other variables showed very low negative correlations and without significant effects, resulting from the buffering capacity of the alkalinity of the medium. With the application of organic loads of 1, 2, 3, and 4 kg m−3 day−1 of COD along the four phases, there were extremely high, positive, and significant correlations between the concentrations of TKN and PT and both in relation to each other. EC (0.99 ≥ r ≥ 0.97 and p ≤ 0.01). In addition, very high and extremely high negative correlations were observed with respect to the concentrations of PT (r = − 0.81 and p ≤ 0.1) and TKN and EC (− 0.91 ≤ re ≤ 0.05), respectively. Thus, it is indicated that the increase in the concentrations of TKN, PT, and EC is conditioned to the increase of the organic loads affluent to the UASB reactor.

The pH results reported in the literature as an important agent in the dynamics of nitrification (Yue et al. 2018) have no visible influence on the dynamics of NO2 - N and NO3-N in the complete assessment of all phases of SABF and HSSF-CW. The same occurred with other variables, indicating that the concentrations of nitrite and nitrate are related to complex interactions (mechanisms of nitrification and denitrification) which, in turn, are influenced by factors other than pH.

The aerobic and anoxic conditions in the SABF and HSSF-CW reactors, to change the dynamics of nitrogen forms by nitrification and by organic demands (Jizheng et al. 2019), optimized the conversion of TKN concentrations to NO2 - N and NO3-N. As the effective reduction of the COD/TKN ratio over the phases is observed in the SABF reactors (phase 27.0 - I and 7.2 - IV) (Fig. 4b) and HSSF-CW reactors (phase 48.6 - I and 10, 7 - IV) (Fig. 4c), it indicates that there was no increase in the rate of nitrification in the same proportion that increased the applied TKN loads and that the COD was removed in the four phases. The increase in the organic load increases the oxygen uptake by heterotrophic bacteria, reducing the nitrification potential, which would increase the COD/TKN ratio from the first to the fourth phase, conditions that justify the COD/TKN data to be negatively correlated with the concentrations of TKN and NO3 - N.

On the other hand, the high COD/TKN rates observed in the HSSF-CW are due to the interaction of several nitrogen removal mechanisms (denitrification, absorption of Tifton 85 grass, anaerobic ammonium oxidation, and microbiological activity) in the medium that intensifies the removal from TKN (Huang et al. 2019).

The COD/TKN values, after 300 days of monitoring, are in line with several studies that state that values between 6.0 and 11.0, approximately, can allow the appropriate removal of nitrogen (Pelaz et al. 2018). In addition, according to (Lin et al. 2016), when the C/N ratio is less than 5 it significantly affects the nitrification process and the total nitrogen removal falls below 50%, while a high C/N ratio (7–30) provides high efficiency and removal of COD, corresponding to about 92%, due to the predominance of heterotrophic bacteria over autotrophic bacteria.

In a qualitative analysis of the data, the presence of discrepancies is found in the distribution histograms of the correlated data (Fig. 4 a, b, and c), highlighted by dotted circles on the main diagonal, indicating values that deviate from normality and may cause anomalies in final results (Gebski and Wong 2007). These values may have been caused by operational peaks on collection days, such as clogging in the UASB reactor, power outages in the SABF reactor, and dragging of solids or dilution of compounds in the HSSF-CW, and were also observed in changes in organic composition of 1, 2, 3, and 4 kg m−3 day−1 of COD.

3.3 Principal Component Analysis

The evaluation of data by correlation analysis, although it is a useful method to categorize the interactions between two variables, the results of applying this analysis are limited to simultaneously evaluate the correlations between various variables (Rastogi and Sinha 2011). Given this, PCA was an important option that could be applied to investigate the relationships between large groups of original variables (Enitan et al. 2018). The PCA analysis, presented in Supplementary Table S2 and Fig. 5, provides information on eigenvalues, data loading before and after varimax rotation, and Keiser and Bartlett tests for the variables of each reactor. These loads reflect the relative importance of each variable for a specific main component: the greater the loading of a variable, the greater the contribution to the variation that PCs represent.

Fig. 5
figure 5

Principal component analysis (PCA) biplot between the variables of wastewater quality with formation of loading vector clustering of variables after varimax rotation and normalization. (a, b: UASB; c, d: SABF; e, f: HSSF-CW)

The adjustments of the analysis that preceded the PCA study provided values of 0.750, 0.794, and 602 for the Kaiser test (KMO) for the data variability in the UASB, SABF, and HSSF-CW reactors, respectively (Supplementary Table S2), and Bartlett’s Sphericity test with inspection of values close to zero (p < 0.0001). Thus, the results analyzed in the study indicated statistically significant relationships between the variables, validating the analytical application of the PCA (Kaiser 1974).

With the data from the normalized PCAs, rotated and following the Kaiser principle for the definition of the PC numbers (eigenvalues > 1), two components were produced for the three UASB, SABF, and HSSF-CW reactors, explaining most of the present variability the data set. In the UASB reactor, the two PCs explained 81.87% of the normalized data set, which, according to Saha and Rahman (2018), is considered a good and reliable result for the identification of the main sources of variation in the environmental samples. This value is the result of the sum of the component PC1, with a variation of 61.30% of the data (eigenvalue PC > 3.0) and strong and significant correlations between the variables EC, TKN, and PT of the original and rotated matrix and by the variable component PC2 with a variation of 20.56% (eigenvalue PC > 1.0), showing a strong pH effect on the other UASB variables (Supplementary Table S2).

In SABF and HSSF-CW, the two PCs represented 66.73 and 61.66% of the representative variability of the data, respectively, resulting in strong and significant loads (load > 0.5) of the effluent quality variables, in addition to providing a standard data set, highlighted in bold. The components PC1 and PC2 showed representative variance of 44.58 and 22.14%, respectively, in SABF, and between 41.54 and 20.11%, respectively, in HSSF-CW, after normalization and varimax rotation (Supplementary Table S2). These results, in addition to strengthening the strong and significant ionic effect in PC1 by EC (0.863 in SABF and 0.905 in HSSF-CW), similar to the load factor of 0.808 EC, observed by Verma and Suthar (2018), indicate that in reactors with greater interactions of the mechanisms responsible for nutrient removal, organic stabilization, and microbiological effects, such as those observed in aerated reactors (Yue et al. 2018) and HSSF-CW (Jizheng et al. 2019), there is a greater number of variables that interfere in the reactor efficiency. For this reason, in some cases, it is difficult to observe the clear effect of one variable on another, such as the influence of pH on nitrification, as previously discussed.

The load vectors of the variables formed a grouping of data with well-defined patterns, showing strong correlations between the variables TKN, PT, and EC in the UASB reactor and between pH, EC, TKN, and PT in the SABF and HSSF-CW reactors, with directions of the vectors directed to phase IV, in which an organic load of 4.0 kg m−3 day−1 of COD was applied, indicating the capacity of the reactors to stabilize the different loads applied during the 420 days of monitoring (Fig. 5 a, b, and c).

3.4 Hierarchical Cluster Analysis

The data were analyzed by hierarchical grouping (HCA) which was performed with 105 samples (average values obtained by triplicate) of the nutritional quality variables of the swine wastewater, using the Ward method and the Euclidean Distance as a measure of data dissimilarity (Fig. 6 a and b; Fig. 6 c and d; Fig. 6 e and f). In studies of wastewater treatment, cluster analysis has been used to determine and analyze the affinity between groups of nutritional data and organic matter, according to Dacewicz and Chmielowski (2019).

Fig. 6
figure 6

Dendrogram obtained by hierarchical cluster analysis (HCA) with Ward method

The grouping formations showed similarities and differences between the quality variables. For the UASB reactor, the formation of three groups of data was observed, with greater emphasis on the similarity of TKN, EC, and PT in cluster A1 (Fig. 6a, b). The introduction of dissolved oxygen in the SABF reactor provided greater Euclidean distances and standardized dissimilarity of 41.1, showing four hierarchical groupings class, with emphasis on the B2 group, which includes the variables NO2 - N and NO3 - N and indicates the occurrence of nitrification and reduction of loads of organic/ammoniacal nitrogen, confirmed by the cluster of COD/TKN units (Fig. 6c, d).

In the HSSF-CW reactor planted with Tifton 85 grass, three clusters with 51.1 dissimilarity were identified; in addition, although cluster C1 presented 60% of the representativeness of the data, the greater Euclidean distances are associated with the interaction in cluster C3 with the variables NO2 - N and NO3 - N, caused by denitrification in the reducing environment in the HSSF-CW, as well as by the C2 cluster (Fig. 6e, f). In general, the reduction of similarity between the variables in the grouping classes is associated with a greater influence of the types of applied biological treatment, highlighting as central variables of the clusters at class 1 (C1) TKN in the effluent of the UASB reactor, and the pH that depends on the organic acid dynamics/alkalinity consumption in the SABF reactor and microbiological effects and swine wastewater/support medium/Tifton 85 grass interaction in the HSSF-CW reactor (Fig. 6b, d, f).

Used as nutrient polishing reactors, the conversion of forms of organic and ammoniacal nitrogen into nitric forms, observed in the SABF, and the ability to reduce by denitrification and nitrogen absorption by Tifton 85 grass in the HSSF-CW reactor, contributed to the isolation of clusters B1 and C2, referring to the COD/TKN ratio, corroborating the opposite vector observed in the main components found in Fig. 5 and being similar to the COD and nitrogen clusters and effects obtained by (Dacewicz and Chmielowski 2019) in the study of domestic sewage pre-treated by septic tank and filter filled with poly (ethylene terephthalate) (PET) bottles with high density polyethylene caps.

4 Conclusion

The complete system provided maximum efficiencies of TKN and PT above 85 and 65%, respectively, which shows the capacity for nutritional removal in aerated and plant systems. The graphical correlations confirmed that there was an effect of salinity on the dynamics of the macronutrients nitrogen and phosphorus (r > 0.80), resulting from the dynamics of the removal mechanisms in the integrated system. The PCA data formed two main components in the biological reactors, which explained the greater variability in the data sets. The pH, TKN, and NO2 - N variables showing the greatest effect on the formation of hierarchical clusters, being quality indicators of the nitrification and denitrification. The results suggest that SABF and HSSF-CW, grown with Tifton 85 grass, can be monitored, at the nutritional and organic level, with a smaller number of variables without losing the significance of the data.