BookmarkSubscribeRSS Feed
UKPhD
Calcite | Level 5
Please forgive the long-winded explanation, I am a new SAS user.

I am using RRR to create dietary patterns at a baseline time point and using this pattern to look at diet over a 10 year period which requires repeated scores.

Using the xweight ods output from PROC PLS RRR I am able to use PROC SCORE to produce a score based on individuals food intake. However, I have hit a problem. To check my methodology, I have applied the PROC SCORE to the same data used in the PROC PLS to create a RRR score. The hypothesis was that the applied and natural scores would be the same, however, they are not. They are systematically different by 11.18%. This same ratio appears if i use the same method in a completely different data set with different x groups .

Does anyone have any ideas why this very consistent error keeps cropping up? Does anyone have information on the way in which PROC PLS method = RRR applies its xweights to the data to create the score?

Thanks for any help, code below.

Our code:

*KEEP CENTRED AND SCALED PREDICTOR (FOOD GROUP) VARIABLES & NATURAL DP
SCORE PRODUCED BY EXPL RRR
& REMOVE RAW DATA;
data scaled;
set pattern10;
keep cid_477a qlet $foods2
pred10score1 ;
run;

************************************************************************
CONFIRMATORY RRR USING CENTRED AND SCALED DATA;

*MAKE XWEIGHTS (SCORING FILE) SUITABLE FOR PROC SCORE;

data scores;
set rrr10xweights;

if Numberoffactors > 1 then delete;*only interested in 1st pattern;
drop Numberoffactors;

_TYPE_="SCORE";
_NAME_="Factor1";

/* rename scoring variables to match scaled predictor variable names*/
rename $foods = $foods2;
run;

*RE-SCORE SCALED AND CENTRED PREDICTOR VARIABLES using scoring
coefficients to test confirmatory RRR;

proc score data=scaled out=pattern10_1 score=scores type="SCORE"
nostd;
var $foods2;
run;

***************************************************************************
COMPARE 'NATURAL' AND 'APPLIED' SCORES;

*check correlation between natural and applied scores;
proc corr data=pattern10_1;
var pred10score1 factor1;
run;

*calculate differences and ratio b/w natural and applied scores;

proc rank data=pattern10_1 out=ranks;
ranks rankpred10 rankfact1;
var pred10score1 factor1;
run;

proc sort data=ranks;
by pred10score1;
run;

data rankdiff;
set ranks;
difpat1=factor1 - pred10score1;
ratiopat1=factor1/pred10score1;
difrank=rankpred10 - rankfact1;
run;

proc means;
var difpat1 ratiopat1 difrank;
run;

Message was edited by: UKPhD Message was edited by: UKPhD
2 REPLIES 2
ChuksManuel
Pyrite | Level 9

Hello,

 

I am having the same problem and i am surprised no statistician here can help.

Did you finally find a solution to the problem?

 

PaigeMiller
Diamond | Level 26

@ChuksManuel wrote:

 

I am having the same problem and i am surprised no statistician here can help.

Did you finally find a solution to the problem?

 


I'm skeptical that you have the "same" very specific problem that was described in this message; you may have a similar problem, but it would help if you described your problem in detail, starting from the beginning.

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1427 views
  • 0 likes
  • 3 in conversation