Standardized residuals in two-way tablesI should compute the standardized residuals for two-way (as well as multiway) tables - option CROSSLIST(STDRES) of PROC FREQ in SAS, if this helps. I didn't find any options, nor a suitable script. Any suggestion? Thank you.
Re: Standardized residuals in two-way tablesThank you for the new version.
It's true what you say: the not adjusted residual is the square root of the cell Chi square, but still you should export the table to Excel to perform the easy calculations. Actually this is what I used to do before: with your script it's much faster.
If you want to check one more possible improvement, note that the script does not show the std residuals when either variable contains missing values. I mean: the table with the frequencies is displayed correctly (e.g. without missing values), but the residuals are not displayed at all. I tried to pre-filter the data table in order to avoid any missing values, but it didn't solve the issue.
Re: Standardized residuals in two-way tablesI fixed one problem and created another. My previous change accommodated cases where the data was pre-summarized and the count for each response-factor cell was available. Unfortunately, the script no longer accommodated the original case without pre-summarization. I fixed that with this latest version.
BTW, the not adjusted residual is just the square root of the cell Chi square.
Re: Standardized residuals in two-way tablesGot it, thanks. I hope it will be useful for somone else.Re: Standardized residuals in two-way tablesActually, I mistakenly got the computation of the not adjusted and adjusted backward. I fixed it. I also added the option analysis Freq role in case your data is pre-summarized. My apologies.
Use the new script here.
Re: Standardized residuals in two-way tablesNow it's fine, I will definitely adopt it. Thank you again
Re: Standardized residuals in two-way tablesI discovered what you meant by the error and corrected the computation. Also, the launch dialog now provides a choice between the adjusted or the not adjusted computation, with not adjusted as the default choice.
Thanks for pointing out the error. That is why I asked for your review! I was taking a short cut and missed the important distinction in the counting process.
Re: Standardized residuals in two-way tablesThis formula is from the SAS documentation for the FREQ procedure:

I didn't see mention of an adjusted or not adjusted residual, only this formula. You modification of the script is fine, but you can comment out the line with the adjusted formula. You are computing the residual twice.
What do you ;mean "there should be an error in the way pidot# and pdotj# are calculated?"
Why do you prefer the un-adjusted version?
Re: Standardized residuals in two-way tablesThank you for your script.
Actually there are two formulas for the std res: adjusted and not adjusted. The one you used was the adjusted one (which is fine), but there should be an error in the way pidot# and pdotj# are calculated. Unfortunately I can't really understand the script, hence I can not fix it. I simply added a row with the (slightly simpler) alternative formula, just to check where the problem is - in case you are still interested.
Re: Standardized residuals in two-way tablesThe computation is simple so I scripted it for you. It is a simple script without any extra features. It will launch the Contingency platform with your selected response and factor and then add a new report at the bottom with the standardized residuals.
I would appreciate it if you would independently verify the results, perhaps running your example through SAS first and then JMP.
Re: Standardized residuals in two-way tablesthank you
Re: Standardized residuals in two-way tablesYou can analyze two-way contingency tables using Analyze > Fit Y by X (launches the Contingency platform) or by using Analyze > Fit Model (launches Nominal Logistic platform or Ordinal Logistic platform, depending on modeling type of response variable). Unfortunately, none of these analyses provide the residual that you want.
I am also unaware of any script for such a result.