BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
brandonmadsen
Calcite | Level 5

Could anyone help me diagnose why this code fails (system becomes unresponsive, need to close browser window and start a new session) as soon as PROC MCMC starts running, before it even has a chance to put out a single line to the log?  Everything before PROC MCMC runs fine on its own. By the time PROC MCMC runs, all the data I'm using has been converted to numeric, and all the non-categorical variables have been standardized.  There is no missing data.

 

I'm using SAS Studio Release 3.7 (Enterprise Edition) on Google Chrome Version 71.0.3578.98 (Official Build) (64-bit).  

 

EDIT @9:17 1/14/2019: PROC MCMC runs in general, including on this same dataset if I use fewer parameters.  Since making this post, I was able to get this code to run by simply changing the algorithm to the default rather than NUTS (i.e. by deleting "alg=nuts" from the PROC MCMC line).  So whatever the issue is, it seems to be something about the way NUTS does its initial optimization/tuning.

 

FILENAME REFFILE '/home/brandonmadsen1/toneGlideFFR_forR.csv';

PROC IMPORT DATAFILE=REFFILE DBMS=CSV OUT=tg_orig;
	GETNAMES=YES;
RUN;

data tone_glide;
	set tg_orig;
	* logit transform to allow use of normal distribution (0-1 scale --> -inf to +inf scale);
	rho_logit=log(rho/(1-rho));
run;

proc standard data=tone_glide mean=0 std=1 out=STD_TONE_GLIDE;
	Var freq rho_logit hzPerSec snrDb lagMs tMs rho;
Run;

proc transreg data=std_tone_glide design;
	model identity(freq|hzPerSec|tMs / tstandard=z)|class(mont|direction|group);
	id sid slopeCode rho_logit rho snrDb octsPerEpoch lagMs;
	
	output out=std_tone_glide;
run;
%put &_trgind;

* macro for putting linear model into proc mcmc;
%macro linpred;                               
                %do i=1 %to 96;
                                beta&i.*data[&i.] +
                %end;
%mend linpred;

%put %linpred 0;

options nocenter;
ods graphics on;

proc mcmc data=std_tone_glide nmc=3000 nbi=1000 alg=nuts(maxheight=12) propcov=quanew
		statistics(percent=5.5 94.5)=(summary) outpost=op;
	array data 1 &_trgind;
	array beta[96] beta1-beta96;
	mu = 0 + %linpred 0;  *zero at end because of trailing "+";
	parms beta: sigma;
	prior beta: ~ normal(0, sd=1);
	prior sigma ~ expon(scale=1);
	model rho_logit ~ normal(mu , sd=sigma);
run;

ods graphics off;

 

1 ACCEPTED SOLUTION

Accepted Solutions
brandonmadsen
Calcite | Level 5

PROC MCMC runs in general, including on this same dataset if I use fewer parameters.  Since making this post, I was able to get this code to run by simply changing the algorithm to the default rather than NUTS (i.e. by deleting "alg=nuts" from the PROC MCMC line).  So whatever the issue is, it seems to be something about the way NUTS does its initial optimization/tuning.

View solution in original post

2 REPLIES 2
Reeza
Super User
Does MCMC run at all? Did you try any of the samples in the documentation?

Usually that happens because there's an error in the PROC and SAS Studio isn't quite at the level of failing gracefully all the time yet. Or it's a bug. But checking if it works at all is the easiest solution.

You can also contact SAS tech support since you're running an Enterprise solution and they can help you debug.
brandonmadsen
Calcite | Level 5

PROC MCMC runs in general, including on this same dataset if I use fewer parameters.  Since making this post, I was able to get this code to run by simply changing the algorithm to the default rather than NUTS (i.e. by deleting "alg=nuts" from the PROC MCMC line).  So whatever the issue is, it seems to be something about the way NUTS does its initial optimization/tuning.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 871 views
  • 0 likes
  • 2 in conversation