Вы находитесь на странице: 1из 4

Universidad de San Carlos de Guatemala

Facultad de Ingeniería
Escuela de Estudios de Postgrado
Maestría en Estadística Aplicada
Curso: Análisis Multivariado

Pruebas De Normalidad
a. Generar una matriz de datos multivariada de 50x3
Pasos para la generación de la matriz en R
1. > library(MASS)
2. > medias=matrix(c(1,3,0)) # vector de medias
3. > s=matrix(c(4,2,1,2,3,1,1,1,5),ncol=3,byrow = 3):matriz de covarianza
> x=mvrnorm(50, medias,s): genera 50 valores para cada variable.

[,1] [,2] [,3]


[1,] 2.234450803 3.33366362 -3.218620150
[2,] -1.883617497 2.12858111 -2.643461793
[3,] 4.626054682 3.71146740 -2.687003101
[4,] -0.734458082 5.69234829 -0.384380684
[5,] 3.078480201 5.08520654 1.098782558
[6,] 2.293062525 4.16862867 -0.252476033
[7,] -0.281492879 3.68206987 -1.509119963
[8,] 0.368737566 0.82116922 -2.031200020
[9,] -1.996399618 1.71081070 -2.556909466
[10,] 3.764272192 5.36848947 -2.189065705
[11,] -1.019626504 0.06523650 2.013841715
[12,] -5.336183102 1.26194104 1.160377750
[13,] 1.845287066 2.89652612 -0.164122702
[14,] -1.151419769 0.33435153 2.594240399
[15,] -0.662368033 2.89132185 0.579441629
[16,] -0.183789819 -0.13119658 1.291215866
[17,] 3.401451276 4.51676338 -1.658065639
[18,] 0.003778122 4.52916790 2.233876361
[19,] -0.382268821 1.09137435 0.828300980
[20,] 2.309363834 4.49711264 -1.614911254
[21,] 2.025967083 6.06468043 -1.031612402
[22,] -0.107526666 0.89318762 1.603378194
[23,] 2.452157843 5.07221769 -1.850976730
[24,] -1.529928547 3.74849752 0.082307231
[25,] 2.534684728 4.35668689 1.807512002
[26,] -0.724559228 1.61643121 -1.014995515
[27,] 4.157994048 4.50869764 2.046611937
[28,] -2.283555990 -1.77244184 -4.598494210
[29,] 2.142003592 3.44289857 -1.249788638
[30,] 0.730260898 5.18738123 -0.003248031
[31,] -0.008306193 1.15754076 -1.959898072
[32,] -1.742274112 0.91746003 0.497644702
[33,] -1.474327232 1.69135899 0.196709962
[34,] 0.729480872 5.74159439 -2.034790519
[35,] 3.183686456 2.91428372 -0.539932008
[36,] 5.388752704 5.12803806 0.953707725
[37,] -3.900290384 0.90118910 -1.460777048
[38,] -2.761388887 1.48445490 -1.180265502
[39,] 0.446803968 -0.05309208 -1.869725294
[40,] -0.042177725 1.82096209 -0.653667063
[41,] 0.185412058 3.53068015 0.188073999
[42,] -0.391112560 2.06940381 -0.057709713
[43,] 1.562086154 2.15283058 3.266436792
[44,] 3.119767427 6.61344870 2.128842535
[45,] 3.822722924 6.85725601 -1.965634778
[46,] 1.746458782 2.04384948 -3.781774109
[47,] 2.664875991 3.42213708 2.032716245
[48,] -0.609016406 1.17307695 -1.712623008
[49,] -1.100563732 3.63100521 0.051934612
[50,] 2.754789001 3.11006795 1.236656931

b. Diferentes pruebas de normalidad

1. Shapiro Test

Shapiro-Wilk normality test

data: datos
W = 0.99317, p-value = 0.6986

2. Test de Royston

> mvn(datos,mvnTest = "royston")


$`multivariateNormality`
Test H p value MVN
1 Royston 1.063081 0.7846015 YES

$univariateNormality
Test Variable Statistic p value Normality
1 Shapiro-Wilk Column1 0.9827 0.6678 YES
2 Shapiro-Wilk Column2 0.9769 0.4304 YES
3 Shapiro-Wilk Column3 0.9813 0.6099 YES

$Descriptives
n Mean Std.Dev Median Min Max 25th 75th
1 50 0.6937042 2.191693 0.4077708 -5.336183 5.388753 -0.6490301 2.305289
2 50 2.8598615 1.991263 2.7171863 -1.772442 6.857256 1.1952930 4.505801
3 50 -0.3252589 1.728509 -0.2355481 -4.598494 3.266437 -1.6544147 1.027378
Skew Kurtosis
1 -0.25579594 -0.1581184
2 0.07447714 -0.8305717
3 -0.05994668 -0.5770454

3. Test de Mardia
> mvn(datos,mvnTest ="mardia")
$`multivariateNormality`
Test Statistic p value Result
1 Mardia Skewness 8.30244911130491 0.599320283714103 YES
2 Mardia Kurtosis -0.611719009297663 0.540723682717822 YES
3 MVN <NA> <NA> YES

$univariateNormality
Test Variable Statistic p value Normality
1 Shapiro-Wilk Column1 0.9827 0.6678 YES
2 Shapiro-Wilk Column2 0.9769 0.4304 YES
3 Shapiro-Wilk Column3 0.9813 0.6099 YES

$Descriptives
n Mean Std.Dev Median Min Max 25th 75th
1 50 0.6937042 2.191693 0.4077708 -5.336183 5.388753 -0.6490301 2.305289
2 50 2.8598615 1.991263 2.7171863 -1.772442 6.857256 1.1952930 4.505801
3 50 -0.3252589 1.728509 -0.2355481 -4.598494 3.266437 -1.6544147 1.027378
Skew Kurtosis
1 -0.25579594 -0.1581184
2 0.07447714 -0.8305717
3 -0.05994668 -0.5770454

c. Graficos de distribuciones marginales