Tuesday, 8 January 2013

BUSINESS APPLICATION IT LAB

IT Business Application Lab Assignment#1

Session 1 :
Date: 8th Jan 2013

Briefing R:

  • R is a software package especially suitable for data analysis and graphical representation. 
  • Functions and results of analysis are all stored as objects, allowing easy function modification and model building.
  • R provides the language, tool, and environment in one convenient package.
Benefits of R:
  • It is very flexible and highly customization.
  • Excellent graphical tools make R an ideal environment for EDA (Exploratory Data Analysis)
  • Since most high level functions are written in R language itself,the language can be learnt by studying the function code.
Weakness of R:
  • R is not particularly efficient in handling large data sets.
  • R is rather slow in executing a large number of for loops, compared to compiler languages.


Assignment 1:
Draw a histogram concatenating 3 data points.

Solution:

>x<-c(1,2,3)
>plot(x,type="h")

Output :




Assignment 2:  
Drawing a line graph with points and naming the graph and the axis.

Solution:
Step 1:
Let z be the variable that contains data from the .csv file selected.
Reading from the csv file

> z<-read.csv(file.choose(), header=T)

This command asks the user to select the file from the saved location.

Step 2:
Let, zcol1 be the variable that contains contents of column 3 and all rows from the excel datasheet.

> zcol1<-z[,3]
> plot(zcol1 , type="b" , main="NSE Graph" , xlab="Time" , ylab="indices")


Output:



Assignment 3:


Create a scatter plot by using share HIGH and LOW values from the NSE Historical data as obtained from the .csv file.

Solution :

HIGH values are obtained from column 3 from the csv file
> zcol1<-z[,3]
LOW values are obtained from column 4 from the csv file
> zcol2<-z[,4]

Now,To plot the scatter plot
> plot(zcol1,zcol2)

Output:



Assignment 4:


To find the volatility between the share values obtained from NSE historical data and obtain the range for the same.

Solution :-
To obtain the volatility , we require the highest value in the HIGH values column and the lowest value among the LOW values column.

Merging both the columns into one vector variable 'y' to get the HIGH and LOW values together can be done by using the following command:

> y<-c(zcol1,zcol2)
> summary(y)
   Min.    1st Qu.  Median    Mean   3rd Qu.    Max.
   4888    5660    5723        5758    5884       6021

Now as we have got the max and min values we can find the range hence the required volatility.

> range(y)

[1] 4888.20 6020.75

Output:



Thank You!!!


No comments:

Post a Comment