Linear regression
We try to explain « choice » by « age »
LIBNAME mydata "D:\SAS"
access=readonly;
PROC IMPORT OUT= WORK.ESTIM DATAFILE=
"D:\SAS\estim20171220.csv"
DBMS=TAB REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;
PROC SORT data=estim; by date;
PROC FREQ data=estim; TABLES age date choice;
RUN;
* categorical explanatory variable;
PROC GLM data=estim; model choice
= age /solution;
run;
* means for majordeplife;
PROC sort; by age;
Proc means; var choice;
by age;
run;
* bar graph;
Proc GCHART; vbar choice /discrete type=mean sumvar=age;
run;
proc reg;
model choice=age;
run;
La procédure GLM Variable dépendante : choice
Source DDL Somme des carrés Carré moyen Valeur F Pr > F
Modèle 1 2689.3638 2689.3638 411.99 <.0001
Erreur 23231 151645.6289 6.5277
Total 23232 154334.9927
R-carré Coef de var Racine MSE choice Moyenne 0.017425 51.10455 2.554942 4.999440
Paramètre Estimation Erreur type Valeur du test t Pr > |t|
Constante 5.950084736 0.04974458 119.61 <.0001 Age -0.038691655 0.00190622 -20.30 <.0001
In conclusion we can say that there is a linear correlation between « choice » variable and « age »:
People are more risk averse when they get older or an other way to say the same result is that younger people are more risk lover.
This can be interpreted in this way :
When you are young, you take risk by optimism When you get older, experienced, you prefer safety