BookmarkSubscribeSubscribe to RSS Feed
anne_sa

Community Trekker

Joined:

Feb 24, 2016

Save columns option with mixed model

Hello everybody,

 

When we run a mixed model using the Fit Model platform, we can save residuals and predicted values but we also have the possibility to save Conditional residuals and Conditional predicted values (which take into account both fixed and random effects). However we do not have similar options for the studentized residuals and the StdErr Pred Formula columns.

What is the best way to get or maybe re-calculate the "conditional verison" of these two columns?

 

Note that I am not working with JMP Pro.

 

Thanks in advance for your help!

 

 

8 REPLIES
cwillden

Community Trekker

Joined:

May 1, 2017

Re: Save columns option with mixed model

You can studentize the conditional residuals by dividing by their standard errors.  Save both columns to the table and then compute the studentized values with a column formula.  I'm not immediately sure how to help you with the Std Error Pred Formula.

-- Cameron Willden
anne_sa

Community Trekker

Joined:

Feb 24, 2016

Re: Save columns option with mixed model

Thank you for your answer Cameron!

 

However if you saved the Std Err of residuals I think it is related to those which do not include random effect and not to the conditional residuals. It seems not possible to save the Conditional  Std Err of residuals. I think we can redo the calculation based on the Hats values but the problem is the same: they are probably linked to the "basic residuals".

cwillden

Community Trekker

Joined:

May 1, 2017

Re: Save columns option with mixed model

You're right.  Duh.  I don't have access to JMP Pro, so I can't check it out, but I don't think you'll be able to get all the components you'd need to compute the standardized conditional residuals directly from the report.  PredSE column gives the X matrix as the second argument of Vec Quadratic(), and the report gives you the MSE.  You would have to construct G and Z. 

 

You could get Z from something like:

Design Nom( :RandomEffectCol << Get Values, {list of levels})

 If you have multiple random effects, you could just concatenate those together.

To get G, that would depend on your chosen correlation structure.  If you have a simple correlation structure with all 0's on the off-diagonals, then you can construct G by multipling your vector of variance components with an identity matrix.


Once you have X, G, Z, and the MSE, then you could compute the variance of the error matrix like so:

n = N Row(dt);

V = Z*G*Z` + MSE*Identity(n);
K = Identity(n) - Z*G*Z`*Inv(V);
Q = X*Inv(X`*Inv(V)*X)*X`;

Var_e = K*(V-Q)*K`;

From there, you would take the sqrt of the diagonal elements of Var_e to get the conditional standard errors for your conditional residuals.  I don't think JMP has a function to return just the diagonal elements of the matrix, but here's a simple one that will do the trick:

getDiag = function({X},
	n = ncol(X);
	diags = {};
	for(i=1, i<=N Col(X),i++,
		Insert Into(diags,X[i,i])
	)
);

That's a lot of effort!  Sorry, I wish I knew of an easier way.

-- Cameron Willden
anne_sa

Community Trekker

Joined:

Feb 24, 2016

Re: Save columns option with mixed model

Thank you Cameron for this detailled answer, I will test it!

But indeed it is not an easy way to get  what we want. I wonder why it is not directly available from the save columns menu.

markbailey

Staff

Joined:

Jun 23, 2011

Re: Save columns option with mixed model

You can suggest this feature in the Wish List part of the JMP Community.

Learn it once, use it forever!
anne_sa

Community Trekker

Joined:

Feb 24, 2016

Re: Save columns option with mixed model

Yes that is right I will do that!

GM

Community Trekker

Joined:

Jun 2, 2017

Re: Save columns option with mixed model

If you estimate the random effects using the Fit Model platform with Personality = Standard Least Squares and Method = REML you can extract the standard errors of the random effects by making a data table out of the Random Effect Prediction table - the standard errors are included.   The Mixed Model personality does not output the standard errors with the Random Effect coefficients on the report.

 

anne_sa

Community Trekker

Joined:

Feb 24, 2016

Re: Save columns option with mixed model

Hello GM,

Yes you are right we can extract the standard errors of random effects like that, but what I am looking for are

the standard errors of residuals and of the predicted values. I do no think it is the same information here.