# Dnmioupgeia stnlns me 6 stoixeia # x_c(5,7,7,7,9,8) x # to stoixeio 2 autns tns stnlns # x[2] # to mnkos tns stnlns # length(x) # to teleutaio stoixeio tns stnlns # x[length(x)] # Mesos kai diaspora # mean(x) var(x) # # x[3]_6 x mean(x) var(x) # praxeis me diavusmata # 2*x x*x x^2 # stnln me 10 mndevika # x_c(rep(0,10)) x # stnln me tous api8mous 1,2,3,...,10 # x_c(1:10) x # mndevikos pivakas me 2 grammes kai 5 stnles # x_matrix(c(rep(0,10)),nrow=2,ncol=5) x # 1,2,...,10 topo8etnmeva kata stnles # x_matrix(c(1:10),nrow=2,ncol=5) x # 1,2,...,10 topo8etnmeva kata grammes # x_matrix(c(1:10),nrow=2,ncol=5,byrow=T) x # poses fopes emfavizetai ka8e stoixeio (movo auta pou emfavizovtai) # x_c(5,7,6,7,9,8) x table(x) x_c("S","NS","NS","S","S","S") x # poses fopes emfavizetai ka8e stoixeio apo ta 1,2,...,10 # table(x) table(category(x,levels=c(1:10), ordered=F)) category(x,levels=c(5:10), ordered=F) table(category(x,levels=c(5:10), ordered=F)) # diatetagmevo, max, min # sort(x) max(x) min(x) # ta stoixeia tou x pou eivai >=7 # x x[x>=7] which(x>=7) # ftiaxvw tn grafikn parastasn tns suvaptnsns pukvotntas mias tupikns kavovikns # x_seq(-3,3,0.05) x y_dnorm(x) y plot(x,y,type="l",lty=1) plot(x,y,type="l",lty=1,xlab="eupos tou x", ylab="pukvotnta N(0,1)",xlim=c(-5, 5), ylim=c(-0.5, 1)) # tuxaio deigma mege8ous 500 apo N(0,1) # z_rnorm(500) z hist(z) hist(z,probability=T) hist(z,plot=F) m1_hist(z,plot=F)\$breaks[1] m2_hist(z,plot=F)\$breaks[length(hist(z,plot=F)\$breaks)] hist(z,breaks=seq(m1,m2,0.25),plot=F) hist(z,breaks=seq(m1,m2,0.25),probability=T,ylim=c(0, 1)) x_seq(m1,m2,0.05) y_dnorm(x) lines(x,y) w_pnorm(x) lines(x,w) hist(z,breaks=seq(m1,m2,0.25),plot=F) f_hist(z,breaks=seq(m1,m2,0.25),plot=F)\$counts hist(z,breaks=seq(m1,m2,0.25),plot=F)\$counts fF_c(rep(0,28)) for (m in 2:28){ fF[m]_fF[m-1]+f[m]} fF br_seq(-3.5,3.5,0.25) br br[-1] br[-29] m_(br[-1]+br[-29])/2 m fff_c(rep(m,fF)) fF fff hist(fff,breaks=seq(-3.5,3.5,0.25),probability=T) lines(x,w) fff_c(rep(m,fF/500)) hist(fff,breaks=seq(-3.5,3.5,0.25)) lines(x,w) fff_c(rep(m,fF)) hist(fff,breaks=seq(-3.5,3.5,0.25)) lines(x,500*w) x1_rpois(10,1) x1 mean(x1) x2_rpois(10,2) x2 mean(x2) x3_rpois(10,1.5) x3 mean(x3) x_x1+x3 y_x2+x3 x y plot(x,y) for (m in 1:100) { if (p[m]==0) {x[m]_rnorm(1,1.60,0.03)} if (p[m]==1) {x[m]_rnorm(1,1.75,0.03)}} p x hist(x[p==0]) hist(x[p==1]) hist(x) hist(x,probability=T) xx_seq(min(x),max(x),(-min(x)+max(x))/100) lines(xx,2/8*dnorm(xx,1.75,0.03)+6/8*dnorm(xx,1.6,0.03))