MLEst <-
function(S){
ahat=S[1,2]/S[1,1]
vx=S[1,1]
# M on X
Sxx=S[1:2,1:2]
sxy=S[1:2,3]
vem=S[2,2]-S[2,1]*S[1,2]/S[1,1]
# Y on X and M
invSxx=solve(Sxx)
beta.v=invSxx%*%sxy # chat, bhat
vey=S[3,3]-t(sxy)%*%invSxx%*%sxy
thetaMLE=c(ahat,beta.v[2],beta.v[1],vx,vem,vey)
return(thetaMLE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.