Hi,
I am trying to reproduce lsmeans from proc GLM in R and with the help of the online docs and through matrix algebra I can recreate everything but the standard error of the difference of lsmeans.
From the SAS doc:
for LS-means defined by the linear combinations li'b and lj'b of the parameter estimates, Sij^2=MSE*li'*inv(X'X)*lj
This is giving me a negative number.
For balanced data I could get the standard error by taking the square root of the sum of the variances (or sqrt(2)*se of the individual lsmean) but most of the time my data will be unbalanced so this does not hold.
Is there a nice closed form of the relationship between the se for individual lsmeans and their contrasts?
Thanks for your help,
Rick
Message was edited by: RickM