Scénario de test & Cas d'usage
Generation of 1,000 policyholder records with age, car type, and claim counts derived from a Poisson distribution.
| 1 | |
| 2 | DATA mycas.insurance_claims; |
| 3 | call streaminit(12345); |
| 4 | DO policy_id = 1 to 1000; |
| 5 | Age = 18 + floor(rand('UNIFORM') * 60); |
| 6 | CarType = ifn(rand('UNIFORM') > 0.3, 'Sedan', 'Sport'); |
| 7 | Region = ifn(rand('UNIFORM') > 0.5, 'Urban', 'Rural'); |
| 8 | RiskBase = -1.5 + 0.02 * Age + 0.5 * (CarType='Sport') + 0.3 * (Region='Urban'); |
| 9 | Lambda = exp(RiskBase); |
| 10 | NumClaims = rand('POISSON', Lambda); |
| 11 | OUTPUT; |
| 12 | END; |
| 13 | |
| 14 | RUN; |
| 15 |
| 1 | |
| 2 | PROC CAS; |
| 3 | countreg.countregFitModel / TABLE={name='insurance_claims'} class={'CarType', 'Region'} model={depVars={{name='NumClaims'}}, effects={{vars={'Age', 'CarType', 'Region'}}}, modeloptions={modeltype='POISSON'}}; |
| 4 | |
| 5 | RUN; |
| 6 |
| 1 | |
| 2 | PROC CAS; |
| 3 | countreg.countregFitModel / TABLE={name='insurance_claims'} class={'CarType'} model={depVars={{name='NumClaims'}}, effects={{vars={'CarType'}}}} outputTables={names={ParameterEstimates='params'}}; |
| 4 | |
| 5 | RUN; |
| 6 |
The model successfully converges. The 'ParameterEstimates' table shows positive coefficients for 'Sport' cars and 'Urban' regions, indicating higher expected claim counts, validating the business logic.