Stats

Popular Posts

Followers

Mathematica 教學:Varimax rotation

戴忠淵 於 2021年7月4日星期日 上午9:24 發表
varimax[data_]:=
Block[{AA,BB,CC,DD,nn,uu,XX,YY,vdata,angle,Tr,temp,vlist},
{nn,uu}=Dimensions[data];
vdata=Map[Normalize,data];
Do[angle=Arg[nn*
Total[Thread[Complex[vdata[[All,iter[[1]]]],
vdata[[All,iter[[2]]]]]]^4]-
Total[Thread[Complex[vdata[[All,iter[[1]]]],
vdata[[All,iter[[2]]]]]]^2]^2]/4;
Tr={{Cos[angle],-Sin[angle]},{Sin[angle],Cos[angle]}};
vdata[[All,iter]]=vdata[[All,iter]].Tr,
{iter,Flatten[Subsets[Range[uu],{2}]&/@Range[25],1]}];
vdata*(Norm[#]&/@data)
]

L = {{-0.18444, 0.766739, -0.27758, 0.115158, 0.712221}, 
{0.698485, -0.30363, -0.19539, -0.2648, 0.688367}, 
{0.754094, 0.348652, -0.20205, -0.30588, 0.824599}, 
{0.365978, 0.162525, -0.1973, 0.849845, 0.92152}, 
{0.5781630, .044134, 0.452722, 0.157895, 0.566108},
{0.299667, 0.030388, 0.770856, 0.063739, 0.689006}, 
{0.817187, 0.239353, -0.19451, -0.16643, 0.79062}, 
{0.687893, 0.035304, 0.116032, 0.117627, 0.501742}, 
{0.301458, -0.74108, -0.3442, 0.233979, 0.81329}};
 

Map[NumberForm[#,{4,3}]&,varimax[L[[All,1;;4]]],{2}]//TableForm


(* Park, T. (2010). A Note on Terse Coding of Kaiser’s Varimax 
Rotation Using Complex Number Representation.*)
Tags:

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~