私は信頼性の高い分析を行い、Cronbachs Alphaを最大化したいと考えています。私はすでにspss用のマクロを持っていますが、解析の変数の名前をどこに入れるのか、マクロを変数に合わせるために調整する必要があるのか分かりません。変数名は以下のとおりです。spamのマクロを使用したalphamax
ZQ103_05 & ZQ103_01 & ZQ408_04 & ZQ305_04 & ZQ405_03 & ZQ406_02 & ZQ201_06 & ZQ301_06 & ZQ410_07 & ZQ201_07 & ZQ301_07 & ZQ406_05 & ZQ406_06 & ZQ408_05 & ZQ201_08 & ZQ301_08 & ZQ305_06 & ZQ409_05 & ZQ407_07ここZQ411_02 & ZQ203_09 & ZQ203_04 & ZQ203_06 & ZQ203_07 & ZQ203_09 & ZQ203_10
マクロです:事前に
DEFINE alphamax (!POSITIONAL !CHAREND ('/')).
PRESERVE.
SET MXLOOPS = 100000000.
SET LENGTH = NONE.
matrix.
get dt/variables = !1/names = nm/missing = omit.
compute total = rsum(dt).
compute it = ncol(dt).
compute n = nrow(dt).
compute dt = {dt,total}.
compute ones = make(n,1,1).
compute dtc = dt-(ones*(csum(dt)&/n)).
compute vcov = (1/(n-1))*(t(dtc)*dtc).
compute ivar = diag(vcov).
compute dt = dt(:,1:it).
compute x = make(1,it,0).
compute k = 0.
compute y = make(((2&**it)-1)-it,it+3,0).
loop j = 1 to ((2&**it)-1).
compute x(1,1)=x(1,1)+1.
loop i = 1 to it.
do if x(1,i) = 2.
compute x(1,i)=0.
compute x(1,i+1)=x(1,i+1)+1.
end if.
end loop.
do if rsum(x) > 1.
compute ttl = dt*t(x).
compute tmp = {ttl,total}.
compute tmpc = tmp-(ones*(csum(tmp)&/n)).
compute vcov = (1/(n-1))*(t(tmpc)*tmpc).
compute var = diag(vcov).
compute r = mdiag(1/sqrt(var))*vcov*mdiag(1/sqrt(var)).
compute r = r(2,1).
compute alpha=(rsum(x)/(rsum(x)-1))*(1-(x*ivar(1:it,1))/var(1,1))).
compute k = k + 1.
compute y(k,:)= {x, alpha, r, rsum(x)}.
end if.
end loop.
compute res = make(it,3,0).
loop i = 1 to it.
compute pre = {make(nrow(y),1,1), y(:,i)}.
compute b = inv(t(pre)*pre)*t(pre)*y(:,(it+1)).
compute res(i,:)={b(1,1),(b(1,1)+b(2,1)),b(2,1)}.
end loop.
compute tp = make(it,1,-999).
compute tp2 = tp.
compute tp3 = tp.
compute tp4 = tp.
loop i = 1 to (nrow(y)).
do if (tp(y(i,it+3),1) < y(i,it+1)).
compute tp(y(i,it+3),1) = y(i,it+1).
compute tp2(y(i,it+3),1) = y(i,it+2).
end if.
do if (tp3(y(i,it+3),1) < y(i,it+2)).
compute tp3(y(i,it+3),1) = y(i,it+2).
compute tp4(y(i,it+3),1) = y(i,it+1).
end if.
end loop.
compute tmp = {t({2:it}), tp(2:it,1), tp2(2:it,1)}.
print/title = "*** Subtest Statistics are in Data Window ***".
print res/title = "Mean Scale Alpha for All Possible Scales With
and Without Item"/clabels = "Without" "With" "Gain"/rnam/format=F8.4.
print tmp/title = "Maximum alpha (a_sub) as a Function of Number
of Items"/clabels = "Items" "a_sub" "r_sub"/format = F8.4.
print/title = "* r_sub is correlation between scale with maximum
alpha and full scale total.".
compute tmp = {t({2:it}), tp3(2:it,1), tp4(2:it,1)}.
print tmp/title = "Maximum Subscale-Full Scale Correlation as a
Function of Number of Items"/clabels = "Items" "r_sub"
"a_sub"/format = F8.4.
compute nms = {nm, "a_sub", "r_sub", "items"}.
print n/title = "Number of cases:".
save y/outfile = */names = nms.
END MATRIX.
format !1 items (F2.0).
format a_sub r_sub (F6.4).
variable labels a_sub "Cronbach's alpha".
variable labels r_sub 'Correlation with total from full scale'.
variable labels items 'Number of Items'.
sort cases by a_sub (d).
RESTORE.
!END DEFINE.
ありがとう!
私は「名前」のための変数を追加しようとしたが、それは動作しませんでした.. – Fox