In: Statistics and Probability
Please provide R code along with explanations for the following exercise:
Mortality rates per 100,000 from male suicides for a number of age groups and a number of countries are given in the data suicides2 (R package “HSAUR2”). Use appropriate graphical methods to comment on what the graphic tells us about the data.
The required r codes along with the graphical plots are listed
below,
*************************************************************************************************************************************************
library(HSAUR2)
data("suicides2")
## Creating age group wise boxplot for whole data
d = suicides2
boxplot(d)
Output :-
Interpretation:- The mean
number of male suicides increase with the age group irrespective of
Region
*******************************************************************************************************************************************
## line plot Region-wise
par(mar=c(7,4,4,2)+0.1)
matplot(as.matrix(d),type='l',ylab = "Age Group",main = "Number of
Male Suicides", xaxt="n",col=1:5,lty=1:5)
legend("topright",legend=c("Age 25 - 34","Age 35 - 44","Age 45 -
54","Age 55 - 64","Age 65 - 74"),col=1:5,lty=1:5)
text(1:15,labels=rownames(d),xpd=T,par("usr")[1]-3,srt=45,adj=1)
Output:-