Continuing on my exploration of the log-normal distribution, I'm working on reimplementing some code originally written for a Weibull/Exponential model for a log-normal model. Among the things it does is use SAS's PROX NLMIXED to hard-calculate some likelihoods. While this is technically SAS code, I think it's pretty readable in a code-agnostic fashion.
For example, the Weibull Version:
*Linear Predictor of Event A lam=exp(-(f0*alpha+f1*alpha*X)); *Density of Event A; ff1=alpha*lam*t1**(alpha-1)*exp(-lam*t1**alpha); ff2=alpha*lam*t2**(alpha-1)*exp(-lam*t2**alpha); *Survival function of Event A; sf1=exp(-lam*t1**alpha); sf2=exp(-lam*t2**alpha);
The two survival functions are just at two different points in time for interval censoring.
I've implemented, I believe, the appropriate survival and density functions for a Log-Normal as follows:
*Density of EventA; ff1 = exp(-0.5*((log(t1)-mu)/sigma)**2)/((t1*(2*CONSTANT('PI'))**0.5)*sigma); ff2 = exp(-0.5*((log(t2)-mu)/sigma)**2)/((t2*(2*CONSTANT('PI'))**0.5)*sigma); *Survival function of EventA; sf1= 1 - CDF('Normal',((log(t1)-mu)/sigma)); sf2= 1 - CDF('Normal',((log(t2)-mu)/sigma));
I guess the first part of the question is does that appear correct? My second question is where I'm getting caught up, actually defining the linear predictor for the log normal. I think it should be something along the form of:
mu = exp(f0+f1*X) ala the Weibull above and with sigma estimated outside the linear predictor, but I'm not positive. Can someone point me in the right direction?
Edit: The goal PDF once the syntax errors are fixed is: