标题: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estimatio [打印本页] 作者: shiyiming 时间: 2010-8-16 19:58 标题: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estimatio sas help里搜索Example 6.6: Maximum Likelihood Weibull Estimation,这个例子里,第三个程序,proc nlp中,为什么会把s 求最大值呢,不是应该整个log函数求吗?
proc nlp data=pike tech=tr inest=par1 outest=opar1 outmodel=model cov=2 vardef=n pcov phes;
[color=#BF00BF:18rbghgd]max logf; [/color:18rbghgd]
parms sig c;
profile sig c / alpha = .9 to .1 by -.1 .09 to .01 by -.01;
x_th = days - theta;
s = - (x_th / sig)**c;
if cens=0 then s + log(c) - c*log(sig) + (c-1)*log(x_th);
[color=#BF00FF:18rbghgd]logf = s; [/color:18rbghgd] /*只把s的值赋给logf,而对logf求最大值??*/
run;作者: shiyiming 时间: 2010-8-16 22:15 标题: Re: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estim 对NLP还是不太理解作者: shiyiming 时间: 2010-8-17 01:49 标题: Re: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estim In fact, here s = logf = log(Likelihood) = l, for an observation;
MAX logf; --->maximize the equation of summarization of [logf]i where i from 1 to m if you have m observations
另外,非常羡慕你学习sas两个月就可以做mathematical modeling.作者: shiyiming 时间: 2010-8-17 02:33 标题: Re: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estim 对 我知道max logf是对所有的变量求和之后再求最大值,
但是似然函数不应该是 s + log(c) - c*log(sig) + (c-1)*log(x_th)么 ,而不单是s:
proc nlp data=pike tech=tr inest=par1 outest=opar1 outmodel=model cov=2 vardef=n pcov phes;
max logf;
parms sig c;
profile sig c / alpha = .9 to .1 by -.1 .09 to .01 by -.01;
x_th = days - theta;
s = - (x_th / sig)**c;
if cens=0 then[color=#FF40FF:15q998no] f= s + log(c) - c*log(sig) + (c-1)*log(x_th)[/color:15q998no];
[color=#FF40FF:15q998no]logf = f[/color:15q998no];
run;
另外,非常高兴你的回复,但你不是讽我呢吧,呵呵。接触SAS很久了,不过没专门研究过,学统计很久了哈。作者: shiyiming 时间: 2010-8-17 05:22 标题: Re: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estim 总共19个记录。所以maximize(l1+l2+...+l19);
前17个都是事件(cens = 0),所以 l = - (x_th / sig)**c + log(c) - c*log(sig) + (c-1)*log(x_th) , for i = 1, 2, ..., 17;
后两个是censors(cens = 1),所以 l = - (x_th / sig)**c, for i = 18, 19;
也就是说19个记录生成19个loglikelihood,按照以上的方法。
你的改动有些问题,就是两个censored的值没有考虑其中。
如下的改动应该是等价的:
[code:4m505uxm]proc nlp data=pike tech=tr inest=par1 outest=opar1
outmodel=model cov=2 vardef=n pcov phes;
/* max logf;*/
max s;
parms sig c;
profile sig c / alpha = .9 to .1 by -.1 .09 to .01 by -.01;
x_th = days - theta;
s = - (x_th / sig)**c;
if cens=0 then s + log(c) - c*log(sig) + (c-1)*log(x_th);
/* logf = s;*/
run;[/code:4m505uxm]作者: shiyiming 时间: 2010-8-17 19:22 标题: Re: Sas help里的一个例子-----用NLP作Maximum Likelihood Weibull Estim 还是不太明白,为什么cens = 1,所以 l = - (x_th / sig)**c, 而且也没写 else logf = s,
那前17个 l = - (x_th / sig)**c + log(c) - c*log(sig) + (c-1)*log(x_th) 也没有求最大值 : max l ??