BookmarkSubscribeRSS Feed
WilliamB
Obsidian | Level 7

Hi,

 

 

I have data, which represent the duration of functioning of machines until they break down.

When the observations are negative: the machine did not break down, thus the observation is censored (State=1 if censored, status=0 if observed).

I used the maximum likelihood, with a Weibull distribution.

But I would like to Wald tests, LM (score), and LR tests

How to make them?

Proc logistic?

 

Thank you for your help

 

 

My code:

---------------------------------------------------------------------------

 

title 'TEST Weibulls';
options ls=75 ps=60 pageno=1 nocenter;

data lr1samp;
input tt @@;
* State=1 if censored, status=0 if observed;
days=abs(tt); status=(tt<0); drop tt;
datalines;
6 11 17 42 43 52 75 82 144
148 168 207 212 279 -388 416 443 552
600 600 629 -655 708 743 864 -873 1061
-1225 1257 -1659 -2137 -2188 -2441 -2591 2842 2867
-2880 3509 -4864 5090
;

proc print;
title2 'The data as SAS sees it';
run;
proc lifereg;
title2 'USE PROC LIFEREG TO FIT A WEIBULL DISTRIBUTION';
model days*status(1) = / dist=Weibull;
run;

 

 

---------------------------------------------------------------------------

1 REPLY 1
JacobSimonsen
Barite | Level 11

For the single parameters you will get Wald-test in the parameter-estimates part of the output. For the scale and shape parameter you have to calculate the wald test yourself from the estimate and the standard error; but I will not recommend it as the Likelihood Ratio test are far better. For covariates with several levels the type3 wald test can be calculated from the estiamtes and the covariance-matrix. But the user still has to do the final matrix calculations.

 

The Likelihood ratio tests are not directly calculated, but the the -2LogL are shown per default in the output. If you test covariates you have to run the model again without the covariate you are testing. Then you can calculate the test yourself (silly that it is not shown per default, as it is in Cox-regression). If you are testing scale=1 you can run the model with "noscale"-option and compare the two -2LogL in a chisquare distribution with 1 df. Similar, if you are testing shape=1 you can run the model with "noshape"-option and compare the two -2logL in a chisquare distribution with 1 df.

 

Unfortunately the Score tests are not shown, and I think that proc lifereg can not help you much to do the calculation yourself, because it does not show the first derivative of the loglikelihood.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1341 views
  • 0 likes
  • 2 in conversation