Hi,
Please see below an example McDonald and Moffit calculation:
gen one=1
mkmat whrs, matrix(y)
mkmat one, matrix(ones)
mkmat one kl6 k618 wa we, matrix(X)
matrix Xb=inv(ones'*ones)*ones'*X
matrix b = e(b)
matrix beta = b[1,5],b[1,1], b[1,2],b[1,3],b[1,4]
matrix BXoverS=Xb * beta'/b[1,6]
scalar Z=el(BXoverS,1,1)
scalar Mu=normalden(Z)/normal(Z)
scalar P=normal(Z)
scalar P1=P*(1-Z*Mu-Mu^2)
scalar P2=normalden(Z*Z+normalden(Z)*Mu)
display Mu
display P
display P1
display P2
My question is specifically on this command: matrix beta = b[1,5],b[1,1], b[1,2],b[1,3],b[1,4]. I'd like to know how the figures in the example command were determined. I understand that figures represent rows and columns for elements of the matrix b, but how do I determine the number and ordering of the elements?
I hope someone can assist.
Please see below an example McDonald and Moffit calculation:
gen one=1
mkmat whrs, matrix(y)
mkmat one, matrix(ones)
mkmat one kl6 k618 wa we, matrix(X)
matrix Xb=inv(ones'*ones)*ones'*X
matrix b = e(b)
matrix beta = b[1,5],b[1,1], b[1,2],b[1,3],b[1,4]
matrix BXoverS=Xb * beta'/b[1,6]
scalar Z=el(BXoverS,1,1)
scalar Mu=normalden(Z)/normal(Z)
scalar P=normal(Z)
scalar P1=P*(1-Z*Mu-Mu^2)
scalar P2=normalden(Z*Z+normalden(Z)*Mu)
display Mu
display P
display P1
display P2
My question is specifically on this command: matrix beta = b[1,5],b[1,1], b[1,2],b[1,3],b[1,4]. I'd like to know how the figures in the example command were determined. I understand that figures represent rows and columns for elements of the matrix b, but how do I determine the number and ordering of the elements?
I hope someone can assist.
Comment