1 Introduzione ad alcuni argomenti del corso

Vengono caricati i packages necessari per realizzare questo documento

1.1 Statistiche descrittive e grafici del data set children.rid

matrice di grafici per le sole variabili gestazione, lunghezza, peso, cranio e su un campione di 2000 righe del data.frame link diretto al grafico 3d.

str(children.rid)
'data.frame':   24553 obs. of  6 variables:
 $ gestazione      : int  41 36 32 34 39 40 40 40 40 38 ...
 $ lunghezza       : int  495 430 430 434 490 490 490 500 505 490 ...
 $ peso            : int  3360 1900 1750 1870 3050 2750 2950 3120 3120 3300 ...
 $ Fumatrici       : int  0 1 2 1 0 0 0 0 0 2 ...
 $ parti.pretermine: int  0 0 0 0 0 0 0 0 0 0 ...
 $ cranio          : int  335 305 300 310 339 330 335 335 355 350 ...
if (sample.set) children.rid=data.sample(children.rid,n)
n=nrow(children.rid)
summary(children.rid)
   gestazione      lunghezza          peso        Fumatrici       parti.pretermine       cranio     
 Min.   :25.00   Min.   :255.0   Min.   : 300   Min.   :0.00000   Min.   :0.000000   Min.   :165.0  
 1st Qu.:38.00   1st Qu.:480.0   1st Qu.:2930   1st Qu.:0.00000   1st Qu.:0.000000   1st Qu.:330.0  
 Median :39.00   Median :500.0   Median :3250   Median :0.00000   Median :0.000000   Median :340.0  
 Mean   :38.75   Mean   :491.8   Mean   :3208   Mean   :0.05364   Mean   :0.009367   Mean   :338.1  
 3rd Qu.:40.00   3rd Qu.:510.0   3rd Qu.:3570   3rd Qu.:0.00000   3rd Qu.:0.000000   3rd Qu.:350.0  
 Max.   :43.00   Max.   :580.0   Max.   :5600   Max.   :3.00000   Max.   :5.000000   Max.   :400.0  
MLA.explor.pairs(children.rid[,ind])

MLA.explor.plot2D(children.rid[,1],children.rid[,3],smooth=.3)
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : pseudoinverse used at 39
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : neighborhood radius 1
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : reciprocal condition number 0
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : There are other near singularities as
well. 1

Grafico 3d interattivo

plot3d(children.rid[,c(2,3,6)])

You must enable Javascript to view this page properly.

1.2 Data set ridotto eliminando le osservazioni con valori non plausibili

Landing spot

attach(children.rid)
sel=gestazione>24&gestazione<45&lunghezza<650&lunghezza>250
graf1=complete(cbind(gestazione, lunghezza, peso,Fumatrici,parti.pretermine,cranio )[sel,])
summary(graf1)
   gestazione      lunghezza          peso        Fumatrici       parti.pretermine       cranio     
 Min.   :25.00   Min.   :255.0   Min.   : 300   Min.   :0.00000   Min.   :0.000000   Min.   :165.0  
 1st Qu.:38.00   1st Qu.:480.0   1st Qu.:2930   1st Qu.:0.00000   1st Qu.:0.000000   1st Qu.:330.0  
 Median :39.00   Median :500.0   Median :3250   Median :0.00000   Median :0.000000   Median :340.0  
 Mean   :38.75   Mean   :491.8   Mean   :3208   Mean   :0.05364   Mean   :0.009367   Mean   :338.1  
 3rd Qu.:40.00   3rd Qu.:510.0   3rd Qu.:3570   3rd Qu.:0.00000   3rd Qu.:0.000000   3rd Qu.:350.0  
 Max.   :43.00   Max.   :580.0   Max.   :5600   Max.   :3.00000   Max.   :5.000000   Max.   :400.0  
dim(graf1)
[1] 24553     6
pairs(graf1[,1:3],col=graf1[,5]+1)

m=100
col1=trunc(scale(graf1[,6],min(graf1[,6]),diff(range(graf1[,6])))*(m-1))
RB=function(m)rgb((m:1)-1,0,1:(m-1),max=m)


plot3d(graf1[,1:3],col=RB(m)[col1])
ndat=nrow(graf1)
points3d(cbind(graf1[,1:2],array(min(graf1[,3]),ndat) )  ,col=2)

You must enable Javascript to view this page properly.