90 likes | 186 Views
Graphical display of data and results . Marek Majdan. Training in essential biostatistics for Public Health Professionals in BiH , Marek Majdan, PhD; marekmajdan@gmail.com. Data distribution plots. Boxplot Q-Q plot Rug plot Histogram.
E N D
Graphical display of data and results Marek Majdan Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Data distribution plots • Boxplot • Q-Q plot • Rug plot • Histogram Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Drawing these plots in R • Boxplot boxplot (variable) • Histogram hist (variable) • Rug plot rug (variable) • Q-Q plot qqplot (variable) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Categorical variables PIE CHART (displays categories of ONE variable) Function in R: pie (data) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Categorical variables • BARCHART (displays categories within one variable or categories in a variable categorized by another categorical variable) • Stacked or with bars beside Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Drawing barplots in R • In case of one variable barplot (variable) • In case of a variable divided by a variable first step: put data in a tabular form tab=table (x) or tab=matrix(c(a,b,c,d),ncol=2,byrow=T) second step: barplot (variable or table) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Line graph • line=c(5,8,9,12,13,5,8,9,11) • plot(lines, type="o“) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
Scatter plot • To display pairs of data • In R: plot(variable x, variable y) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com
General graphical arguments • col =“name of colour” (to get a list of colours put colors() in R) • main=“title”; main title of graph • xlab=“name on x axis” • ylab=“name on y axis” Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com