Hello community,
I am trying to build a regression equation using the proc fmm output:
/* MLE */
ods graphics on /height=900 width=1600;
*ods select DensityPlot;
proc fmm data=casuser.ds gconv=0 plots=density(bins=90) seed=12345 maxiter=2000 plots=all;
class reg_clim_num;
*bayes MUPRIORPARMS((0, 2E12 ) (-40000, .) ) ;
model dk_cons = reg_clim_num / dist=normal k=2 parms(-63745 1688330000000, -39981.1 33440000000);
ods output ParameterEstimates=ParameterEstimates;
*ods output PostSummaries=PostSummaries;
performance cpucount=8;
output out=ds_out predicted=predicted pred=pred mean=mean residual=residual mixprobs=mixprobs mixweights=mixweights;
run;
Which parameters should I use?
y = intercept + ...?
The First Component:
1. For observations for which group="group 1", the conditional distribution of dk_cons is
f_11 = N(Intercept_1 + beta_1, 1.0489), where the second argument is the estimated Variance
2. For observations for which group="group 2", the conditional distribution of dk_cons is
f_12 = N(Intercept_1, 1.0489)
The Second Component:
1. For observations for which group="group 1", the conditional distribution of dk_cons is
f_21 = N(Intercept_2 + beta_2, 1.0197), where the second argument is the estimated Variance
2. For observations for which group="group 2", the conditional distribution of dk_cons is
f_22 = N(Intercept_2, 1.0197)
Let p = 0.2573 be the mixing probability. Then the full model is:
- For observations for which group="group 1", the conditional distribution is p*f_11 + (1-p)*f_21
- For observations for which group="group 2", the conditional distribution is p*f_12 + (1-p)*f_22
The image you posted looks like a summary of the descriptive statistics for variables. You want to use the ParameterEstimates table to interpret the model. In the upper left corner of the screen is a drop-down menu that says PostSummaries. Click on that and see if ParameterEstimates is another option to view.
In addition, for the FMM procedure, you will need to output the MixingProbs table, so add the statement
ods output ParameterEstimates=ParameterEstimates MixingProbs=MixingProbs;
The parameter estimates give the parameters for each component. You will see a column 'Component' that has values 1 and 2, and parameter estimates for "Intercept", the relative increment for each class level, and the variance for each component. The MixingProbs table will have one mixing probability. Use 1-probability as the second mixing probability.
I created my own distribution with the values in the csv, I found just one predicted value with this formula:
predicted=([@[intercept_1]]+[@[beta_1]])*[@probs1]+([@intercept2]+[@[beta_2]])*[@probs2]
How can i find the other predicted value for the other observations?
The First Component:
1. For observations for which group="group 1", the conditional distribution of dk_cons is
f_11 = N(Intercept_1 + beta_1, 1.0489), where the second argument is the estimated Variance
2. For observations for which group="group 2", the conditional distribution of dk_cons is
f_12 = N(Intercept_1, 1.0489)
The Second Component:
1. For observations for which group="group 1", the conditional distribution of dk_cons is
f_21 = N(Intercept_2 + beta_2, 1.0197), where the second argument is the estimated Variance
2. For observations for which group="group 2", the conditional distribution of dk_cons is
f_22 = N(Intercept_2, 1.0197)
Let p = 0.2573 be the mixing probability. Then the full model is:
- For observations for which group="group 1", the conditional distribution is p*f_11 + (1-p)*f_21
- For observations for which group="group 2", the conditional distribution is p*f_12 + (1-p)*f_22
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.