IT Business Applications Lab
Day 1 , 8th Jan 2013
Today we learned a statistical language in the Business Applications IT laboratory. Its named the R and is a very important and powerful language for statistical computing and graphics.
Today we learned a statistical language in the Business Applications IT laboratory. Its named the R and is a very important and powerful language for statistical computing and graphics.
R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible.
One of R's strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
We did some great stuff like reading from a csv file and some functional operations on the data therein.
Below are the assignments from day1.
One of R's strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
We did some great stuff like reading from a csv file and some functional operations on the data therein.
Below are the assignments from day1.
Assignment 1 :
Draw a histogram after concatenating 3 data points.
Soln :
Commands used are as under -:
> x<-c(1,2,3)
> plot(x, type = "h")
Histogram
Assignment 2: Drawing a Histogram with the data extracted from the csv file.
Soln -:
Reading from the csv file is done as under -:
> zcol1<-z[,3]
> plot(zcol1 , type="h")
Soln -:
Reading from the csv file is done as under -:
> z<-read.csv(file.choose(), header=T)
> zcol1<-z[,3]
> plot(zcol1 , type="h")
Assignment 3: Drawing a line graph with points and naming the graph and the axis.
Reading from the csv file is done as under -:
> z<-read.csv(file.choose(), header=T)
This command prompts the user to select the data file from the saved location.
zcol1 be the variable that contains contents of column 3 from the excel data.
the following commands were used.
> zcol1<-z[,3]
> plot(zcol1 , type="b" , main="NSE Graph" , xlab="Time" , ylab="indices")
Min. 1st Qu. Median Mean 3rd Qu. Max.
4888 5660 5723 5758 5884 6021
> range(y)
will give the desired range of volatility
[1] 4888.20 6020.75
the following commands were used.
> zcol1<-z[,3]
> plot(zcol1 , type="b" , main="NSE Graph" , xlab="Time" , ylab="indices")
Assignment 4:
Create a scatter plot by using share HIGH and LOW values from the NSE Historical data as obtained from the .csv file.
Soln :
HIGH values as obtained in previous ques
> zcol1<-z[,3]
LOW values are in column 4 from the csv file
> zcol2<-z[,4]
To plot the scatter plot
> plot(zcol1,zcol2)
Assignment 5:
To find the volatility between the share values obtained from NSE historical data and obtain the range for the same.
Soln -:
To obtain the volatility , we wold require the maximum value amongst the HIGH values and the minimum values amongst the LOW values.
Merging both the columns into one vector variable 'y' to get the HIGH and LOW values together.
> y<-c(zcol1,zcol2)
> summary(y)
will give the min and the max value as under -:
4888 5660 5723 5758 5884 6021
> range(y)
will give the desired range of volatility
[1] 4888.20 6020.75





No comments:
Post a Comment