examples/parallel_analysis.rb in statsample-0.15.1 vs examples/parallel_analysis.rb in statsample-0.16.0
- old
+ new
@@ -12,19 +12,20 @@
vectors={}
variables.times do |i|
vectors["v#{i}"]=samples.times.collect {|nv| f1[nv]*i+(f2[nv]*(15-i))+((f3[nv]*(30-i))*1.5)*rng.ugaussian()}.to_scale
+ vectors["v#{i}"].name="Vector #{i}"
end
ds=vectors.to_dataset
pa=Statsample::Factor::ParallelAnalysis.new(ds, :iterations=>iterations, :debug=>true)
pca=Statsample::Factor::PCA.new(Statsample::Bivariate.correlation_matrix(ds))
-rb=ReportBuilder.new(:name=>"Parallel Analysis with simulation") do |g|
- g.text("There are 3 real factors on data")
- g.parse_element(pca)
- g.text("Traditional Kaiser criterion (k>1) returns #{pca.m} factors")
- g.parse_element(pa)
- g.text("Parallel Analysis returns #{pa.number_of_factors} factors to preserve")
+rb=ReportBuilder.new(:name=>"Parallel Analysis with simulation") do
+ text "There are 3 real factors on data"
+ parse_element pca
+ text "Traditional Kaiser criterion (k>1) returns #{pca.m} factors"
+ parse_element pa
+ text "Parallel Analysis returns #{pa.number_of_factors} factors to preserve"
end
puts rb.to_text