Publications by Al-Ahmadgaid Asaad

Importing Data to R

30.03.2013

There are number of ways in importing data into R, and several formats are available,From Excel to R From SPSS to RFrom Stata to R, and more hereIn this post, I’m going to talk about importing common data format that we often encounter, such as Excel, or Text data. Most of the data are saved in MS Excel, and the best way to import t...

1954 sym

Installing, Loading, and Detaching R Packages

01.04.2013

To install a package in R, the function to be used is install.packages. Let say we want to install the ggplot2 package, well simply code this withTo install more than one package, we do this byNote that in executing the above codes, a dialogue box will pop up asking for the download mirror, just choose the one that’s in or near you...

818 sym

Basic Mathematical Functions

20.04.2013

R can perform the usual mathematical operations, below are the functions:Arithmetic +    – addition–    – subtraction*    – multiplication/    – divisionTrigonometrysin      – sinecos      – cosinetan      – tangentasin    – sine inverseacos    – cosine inverseatan    – tangent ...

1322 sym

Inputting Data in Matrix Format

06.06.2013

Matrix in R is formed using matrix, rbind, or cbind function. These functions have the following descriptions:matrix – used to transform a concatenated data into matrix form of compatible dimensions. rbind – short for row bind, that binds a concatenated data points of same sizes by row.cbind – short for column bind, that bind...

1629 sym

Data Class Conversion

06.06.2013

Data in R can be converted from one class to the other. The function is prefixed with as. then followed by the name of the data class that we wish to convert to. Data class in R are the following:numeric – as.numericvector – as.vectorcharacter – as.charactermatrix – as.matrixdata frame – as.data.frameHence, if one wishes to ...

1302 sym

Matrix Operations

08.06.2013

Matrix manipulation in R are very useful in Linear Algebra. Below are lists of common yet important functions in dealing operations with matrices:Transpose – tMultiplication – %*%Determinant – detInverse – solve, or ginv of MASS libraryEigenvalues and Eigenvectors – eigenConsider these matrices, $\left[\begin{array}{ccc}3&4&...

1259 sym

Mean and Median

08.06.2013

Mean in R is computed using the function mean. Consider the scores of 20 MSU-IIT students in Stat 101 exam with a hundred items: 70, 78, 66, 65, 50, 53, 48, 88, 95, 80, 85, 84, 81, 63, 68, 73, 75, 84, 49, and 77. Compute and interpret the mean and median.Interpretation: Therefore, the average score of the students is 71.6, and half of...

833 sym

Quartiles, Deciles, and Percentiles

09.06.2013

The measures of position such as quartiles, deciles, and percentiles are available in quantile function. This function has a usage,where:x – the data pointsprob – the location to measurena.rm – if FALSE, NA (Not Available) data points are not ignorednames – for attributes, FALSE means no attributes, hence speeds-up the computa...

3096 sym

Measures of Absolute Variability

10.06.2013

Measures of absolute variability deal with the dispersion of the data points. This include the following:Range – rangeInterquartile Range – IQRQuartile DeviationAverage DeviationStandard Deviation – sdThese measures of variability restrict to uniform units of measurement when comparing two distributions.Example 1. The heights (i...

2286 sym

Measure of Relative Variability

10.06.2013

The measure of relative variability is the coefficient of variation (CV). Unlike measures of absolute variability, the CV is unitless when it comes to comparisons between the dispersions of two distributions of different units of measurement. In R, CV is obtained using cv function of raster package (to install an R package, click here...

1903 sym 1 tbl