You are on page 1of 14

Lucrarea de laborator nr.

2
la disciplina Analiza statistica a datelor

Tema: Analiza statistica a datelor cu ajutorul


functiilor grafice hist(), boxplot(),
qqnorm(), qqplot() din limbajul R.

Сделал Mn-222 Sologan Artemios

1.
x=rbinom(100,25,0.6)

par(bg = "yellow")

split.screen(c(2,1))

split.screen(c(1,2), screen = 1)

screen(3)

hist(x,col="gray")

screen(4)

hist(x,breaks=5:25,freq=F, density=6:26,angle=45,col="red")

split.screen(c(1,2), screen = 2)

screen(5)

hist(x,breaks=25,col=1:26,border="green",xlim=c(0,25),

ylim=c(0,30),labels=T)

screen(6)

hist(x,breaks=25,freq=F, col=1:26,border="green",xlim=c(0,25),

ylim=c(0,0.4),labels=T)

close.screen(all = TRUE)

set.seed(0)

par(mfrow=c(1,2))

boxplot(x,width=2,col="blue", pars = list(boxwex = 1))

boxplot(x,range=0,col="green",horiz=F)

set.seed(0)

par(mfrow=c(2,2))

qqnorm(x)

qqline(x)
2.

x=rpois(100,3)

par(bg = "yellow")

split.screen(c(2,1))

split.screen(c(1,2), screen = 1)

screen(3)

hist(x,col="gray")

screen(4)

hist(x,breaks = 0:10,freq = F, density = 6:26,angle = 50,col="red")

split.screen(c(1,2), screen = 2)

screen(5)

hist(x,breaks=20,col = 1:21,border="green",xlim = c(0,11),

ylim=c(0,40),labels=T)

screen(6)

hist(x,breaks=20, freq=F, col=1:21,border="green",xlim=c(0,11),

ylim=c(0,0.7),labels=T)

close.screen(all = TRUE)
set.seed(0)

par(mfrow=c(1,2))

boxplot(x,width=2,col="blue")

boxplot(x,range=0,col="green",horiz=F)

set.seed(0)

par(mfrow=c(2,2))

qqnorm(x)

qqline(x)
3.

x=runif(100,-20,20)

par(bg = "yellow")

split.screen(c(2,1))

split.screen(c(1,2), screen = 1)

screen(3)
hist(x,col="gray")

screen(4)

hist(x,breaks = -20:20,freq = F, density = 6:26,angle = 50,col="red")

split.screen(c(1,2), screen = 2)

screen(5)

hist(x,breaks=-20:20,col = 1:40,border="green",xlim = c(-20,20),

ylim=c(0,15),labels=T)

screen(6)

hist(x,breaks=-20:20, freq=F, col=1:40,border="green",xlim=c(-20,20),

ylim=c(0,0.1),labels=T)

close.screen(all = TRUE)

set.seed(0)

par(mfrow=c(1,2))

boxplot(x,width=2,col="blue")

boxplot(x,range=0,col="green",horiz=F)

set.seed(0)

par(mfrow=c(2,2))

qqnorm(x)

qqline(x)
4.

x=rnorm(100, 2, 3)

par(bg = "yellow")

split.screen(c(2,1))

split.screen(c(1,2), screen = 1)

screen(3)

hist(x,col="gray")

screen(4)

hist(x,breaks = -10:15,freq = F, density = 6:26,angle = 60,col="red")

split.screen(c(1,2), screen = 2)

screen(5)

hist(x,breaks=25,col = 1:15,border="green",xlim = c(-10,15),

ylim=c(0,15),labels=T)

screen(6)

hist(x,breaks=-10:15, freq=F, col=1:15,border="green",xlim=c(-10,15),

ylim=c(0,0.2),labels=T)

close.screen(all = TRUE)

set.seed(0)
par(mfrow=c(1,2))

boxplot(x,width=2,col="blue")

boxplot(x,range=0,col="green",horiz=F)

set.seed(0)

par(mfrow=c(2,2))

qqnorm(x)

qqline(x)
Анализ с qqplot

set.seed(0)

x1=rbinom(100,25,0.6)

x2=rpois(100,3)

x3=runif(100,-20,20)

x4=rnorm(100,2,3)
par(mfrow=c(3,3))

qqplot(x1,x2)

qqplot(x1,x3)

qqplot(x1,x4)

qqplot(x2,x3)

qqplot(x2,x4)

qqplot(x3,x4)

You might also like