inst/examples/R/data/efa/efa_zhou/zhou_scree.R

vl03 <- c(
  10.813,
  2.742,
  1.734,
  1.241,
  1.093,
  .984,
  .878,
  .758,
  .665,
  .632,
  .613,
  .566,
  .526,
  .510,
  .499,
  .469,
  .449,
  .429,
  .420,
  .387,
  .372,
  .349,
  .329,
  .303,
  .290,
  .269,
  .236,
  .228,
  .216)
ue03 <- c(
  7.742,
  3.095,
  1.641,
  1.396,
  1.215,
  .925,
  .910,
  .823,
  .780,
  .633,
  .562,
  .543,
  .520,
  .492,
  .468,
  .444,
  .388,
  .372,
  .362,
  .324,
  .300,
  .292,
  .282,
  .261,
  .232)
vl02 <- c(
  11.181,
  2.771,
  1.851,
  1.442,
  1.007,
  .947,
  .761,
  .687,
  .651,
  .625,
  .576,
  .554,
  .516,
  .485,
  .462,
  .447,
  .437,
  .420,
  .378,
  .369,
  .349,
  .333,
  .309,
  .279,
  .264,
  .254,
  .239,
  .228,
  .176)
ue02 <- c(
  8.560,
  3.066,
  1.587,
  1.347,
  1.036,
  .993,
  .791,
  .766,
  .721,
  .617,
  .551,
  .494,
  .464,
  .459,
  .450,
  .412,
  .375,
  .345,
  .342,
  .315,
  .305,
  .287,
  .260,
  .241,
  .216)

pdf("zhou_scree.pdf", width=5, height=6)
plot(c(1, 7), c(0, 12), type="n", xlab="Factor", ylab="Eigenvalue", main="Scree plot")
lines(seq(vl02), vl02, type="b")
lines(seq(vl03), vl03, type="b", lty="dashed")
lines(seq(ue02), ue02, type="b", col="blue")
lines(seq(ue03), ue03, type="b", col="blue", lty="dashed")
abline(h=1, col="red")
legend <- c("Lecture 2002", "Lecture 2003", "Exercise 2002", "Exercise 2003")
legend("topright", legend=legend, lty=c("solid", "dashed", "solid", "dashed"), 
       col=c("black", "black", "blue", "blue"))
dev.off()
sigbertklinke/shinyExample documentation built on May 26, 2019, 4:32 a.m.