
------

<div style="display:block;clear:both;" class="scale-diagnosis-start"></div>

```{r, eval=TRUE, results="asis", echo=FALSE}

if (!exists('headingLevel') || !is.numeric(headingLevel) || (length(headingLevel) != 1)) {
	headingLevel <- 0;
}

if (!is.null(x$scaleName)) {
  mainHeadingText <-
    paste0(repStr("#", headingLevel), " Scale diagnosis for ",
           x$scaleName);
} else {
  mainHeadingText <-
    paste0(repStr("#", headingLevel), " Scale diagnosis");
}

if (!exists('digits') || !is.numeric(digits) || (length(digits) != 1)) {
  if (is.null(x$digits) || !is.numeric(x$digits) || (length(x$digits) != 1)) {
    digits <- 3;
  } else {
    digits <- x$digits;
  }
}

```

`r mainHeadingText;`

```{r, echo=echoPartial, results='asis'}

cat0("\n\n",
     repStr("#", headingLevel + 1),
     " Reliability (internal consistency) estimates",
     "\n\n");

x$scaleReliability;

cat0("\n\n",
     repStr("#", headingLevel + 1),
     " Eigen values",
     "\n\n");

cat(vecTxt(round(x$eigen$values, 3)));

if (!is.null(x$pca) && !is.null(x$fa)) {
  
  cat0("\n\n",
       repStr("#", headingLevel + 1),
       " Factor analysis (reproducing only shared variance)",
       "\n\n");
  
  print(knitr::kable(as.data.frame(unclass(x$fa$loadings)), digits=digits));
  
  cat0("\n\n",
       repStr("#", headingLevel + 1),
       " Component analysis (reproducing full covariance matrix)",
       "\n\n");
      
  print(knitr::kable(as.data.frame(unclass(x$pca$loadings)), digits=digits));
}

cat0("\n\n",
     repStr("#", headingLevel + 1),
     " Item descriptives",
     "\n\n");

print(knitr::kable(x$describe, digits=digits));
  
cat0("\n\n",
     repStr("#", headingLevel + 1),
     " Scattermatrix",
     "\n\n");

ufs::knitFig(x$scatterMatrix$output$scatterMatrix,
             figCaption = "Scatterplot");

cat0("\n\n");

```

<div style="display:block;clear:both;" class="scale-diagnosis-end"></div>

------
