Scénario de test & Cas d'usage
Simulate a dataset with 500 machines and 20 potential sensor predictors, where only 3 are truly predictive.
| 1 | |
| 2 | DATA mycas.machine_sensors; |
| 3 | call streaminit(456); |
| 4 | array S[20] s1-s20; |
| 5 | DO i = 1 to 500; |
| 6 | DO j=1 to 20; |
| 7 | S[j] = rand('normal'); |
| 8 | END; |
| 9 | TrueRisk = 0.8*s1 - 0.5*s5 + 0.3*s10; |
| 10 | Life = rand('weibull', 1.5) * exp(-TrueRisk); |
| 11 | Fail = 1; |
| 12 | IF Life > 10 THEN DO; |
| 13 | Life = 10; |
| 14 | Fail = 0; |
| 15 | END; |
| 16 | OUTPUT; |
| 17 | END; |
| 18 | |
| 19 | RUN; |
| 20 |
| 1 | |
| 2 | PROC CAS; |
| 3 | phreg.cox TABLE={name='machine_sensors'}, model={depVars={{name='Life', event='Fail(1)'}}, effects={{vars={'s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 's12', 's13', 's14', 's15', 's16', 's17', 's18', 's19', 's20'}}}}, selection={method='STEPWISE', slEntry=0.1, slStay=0.1}; |
| 4 | |
| 5 | RUN; |
| 6 |
| 1 | |
| 2 | PROC CAS; |
| 3 | phreg.cox TABLE={name='machine_sensors'}, model={depVars={{name='Life', event='Fail(1)'}}, effects={{vars={'s1', 's5', 's10'}}}}, OUTPUT={casOut={name='scored_machines', replace=true}, xBeta='RiskScore'}; |
| 4 | |
| 5 | RUN; |
| 6 |
The Stepwise selection should filter out the noise variables (s2, s3, etc.) and retain the significant predictors (s1, s5, s10). The second step generates a table 'scored_machines' containing the 'RiskScore', which the plant can use to prioritize maintenance.