How to install packages in R.
use “install.packages” to install in R to make italic statistics
to make bold probability
to add code
# Descriptive stat using packages
x<-c(21,12,13,14,15)
library(AdequacyModel)
descriptive(x)
## $mean
## [1] 15
##
## $median
## [1] 14
##
## $mode
## [1] NA
##
## $variance
## [1] 12.5
##
## $Skewness
## [1] 1.13842
##
## $Kurtosis
## [1] -0.212
##
## $minimum
## [1] 12
##
## $maximum
## [1] 21
##
## $n
## [1] 5
mean(x)
## [1] 15
median(x)
## [1] 14
range(x)
## [1] 12 21
mode(x)
## [1] "numeric"
summary(x)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12 13 14 15 15 21
library(psych)
describe(x)
descriptive(x)
## $mean
## [1] 15
##
## $median
## [1] 14
##
## $mode
## [1] NA
##
## $variance
## [1] 12.5
##
## $Skewness
## [1] 1.13842
##
## $Kurtosis
## [1] -0.212
##
## $minimum
## [1] 12
##
## $maximum
## [1] 21
##
## $n
## [1] 5
library(EnvStats)
##
## Attaching package: 'EnvStats'
## The following objects are masked from 'package:stats':
##
## predict, predict.lm
summaryFull(x)
## x
## N 5
## Mean 15
## Median 14
## 10% Trimmed Mean 15
## Geometric Mean 14.71
## Skew 1.697
## Kurtosis 3.152
## Min 12
## Max 21
## Range 9
## 1st Quartile 13
## 3rd Quartile 15
## Standard Deviation 3.536
## Geometric Standard Deviation 1.241
## Interquartile Range 2
## Median Absolute Deviation 1.483
## Coefficient of Variation 0.2357
?summaryFull
# Data Visualization
hist(x)
boxplot(x)
y<- c(12,12,12,13,21,23,24,25,18,19,20,21)
z<- c(12,12,12,13,21,23,24,25,18,19,20,21,89)
hist(y)
boxplot(y)
boxplot(z)
plot(density(y))
polygon(density(y),col="red", xlab="age", ylab="weight",
main="medical statistical group")
polygon(density(y),col="red",
xlab="Height", ylab="weight")
hist(y, col="green", xlab="age", ylab="weight",
main="medical statistical group")
plot(density(y),xlab= "age", ylab="weight",
border="black", main = "medical stat group")
## Warning in plot.window(...): "border" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "border" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "border" is not a
## graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "border" is not a
## graphical parameter
## Warning in box(...): "border" is not a graphical parameter
## Warning in title(...): "border" is not a graphical parameter
polygon(density(y),col="blue")
boxplot(z, col="green", xlab="age", ylab="weight",
main="medical stat")
#Data visualization based on package
library(vioplot)
## Loading required package: sm
## Package 'sm', version 2.2-6.0: type help(sm) for summary information
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
vioplot(z, col="green", xlab="age", ylab="weight",
main="medical stat")
library(beanplot)
beanplot(z, col="cyan", xlab="age", ylab="weight",
main="medical stat")
## log="y" selected
library(beeswarm)
beeswarm(z, col="magenta", xlab="age", ylab="weight",
main="medical stat")