Dear experts,
I am trying to apply SAS code
proc mcmc data=crp nbi=50000 nmc=100000 outpost=OutData
init = random monitor=(lw1 lw2 lw3 beta0 delta w);
parms lw1 lw2 lw3 ;
array w[3];
w[1] = exp(lw1)/(exp(lw1)+ exp(lw2)+ exp(lw3));
w[2] = exp(lw2)/(exp(lw1)+ exp(lw2)+ exp(lw3));
w[3] = exp(lw3)/(exp(lw1)+ exp(lw2)+ exp(lw3));
parms beta0 delta ;
prior beta0 ~ cauchy(0,2.5);
prior delta ~ cauchy(0,2.5);
prior lw1 ~ beta(1,1);
prior lw2 ~ beta(1,1);
prior lw3 ~ beta(1,1);
p = beta0+ delta*(w[1]*cesd12+w[2]*cesd22+w[3]*cesd32);
model any_disorder ~ binomial(1,p);
run;
recommended is this paper https://pubmed.ncbi.nlm.nih.gov/29912384/
to examine how a time-varying exposure cesd affects health outcome any_disorder later in life. The code seems to be working when my exposure is binary, but when I am trying to use continuous exposure, I get this error ERROR: The BINOMIAL distribution of any_disorder (Obs = 1553) has an invalid probability -1.12646636. Use an appropriate parameter value instead. Could you you help me to modify the code such that it would work with continuous exposure variables?
Many thanks in advance!
ERROR: The BINOMIAL distribution of any_disorder (Obs = 1553) has an invalid probability
-1.12646636. Use an appropriate parameter value instead.
Your problem is not continuous values but the specific value. Binomial parameter for P in general has a range of 0 to 1. A negative value makes no sense at all.
You need to provide a value between 0 and 1 for P. That may require a pass through a data step to set an appropriate value for P. What that should be I have no clue.
Perhaps you need to look at what creates P very closely and see why it is 1) negative and 2) outside of the intended range of use values (0 to 1). Perhaps some data outlier?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.