Simulando el siguiente modelo lineal: y = β0 + β1x
+ ε. En donde ε
~N(0,22). Asumiendo
x~N(0,12), y β1 = 2
/* Simulando números aleatorios de un modelo de regresión
simple*/
data
simu;
call
streaminit(4); * semilla para numero aleatorio;
do n =
1 to 22;
x = rand('normal', 0, 1);
e = rand('normal', 0, 2); * e ~ U[0,1.5] ;
y = 0.5 + 2*x +
e;
output;
end;
run;
ods html;
proc print data=simu;
var x y;
title 'Simulando numeros aleatorios';
run;
* Estadística descriptiva;
proc means;
var x y;
run;
* Trazando grafico;
symbol1 v=dot
c=blue h=0.4;
proc gplot data =
simu;
plot y *
x ;
run; quit;
* Histograma ;
proc univariate normal plot;
var y ;
histogram / normal
endpoints=-10 to 10 by 1;
title 'Histograma';
run;
ods html close;
SAS output:
Obs | x | y |
---|---|---|
1 | 0.90892 | 3.60999 |
2 | -1.25136 | -1.05504 |
3 | 0.92288 | 1.39040 |
4 | 0.49310 | 1.90526 |
5 | -1.04989 | -0.59980 |
6 | 0.54137 | 3.43311 |
7 | 0.16647 | 0.60868 |
8 | 1.31610 | 6.72692 |
9 | -1.75267 | -0.26809 |
10 | -1.10120 | -3.11889 |
11 | -0.15125 | 0.46123 |
12 | -0.12030 | 1.67640 |
13 | -0.52335 | -0.77536 |
14 | -1.40827 | -0.24826 |
15 | -0.75133 | -2.57447 |
16 | 0.71658 | 6.09058 |
17 | -0.27794 | 0.77255 |
18 | -0.12494 | 0.87593 |
19 | 0.05362 | 1.12343 |
20 | -0.29868 | -3.54520 |
21 | -0.55593 | 0.10502 |
22 | 2.32114 | 4.84260 |
The MEANS Procedure
Variable | N | Mean | Std Dev | Minimum | Maximum | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
No hay comentarios.:
Publicar un comentario