Wednesday, 23 January 2013

Business Application IT Lab


IT Business Application lab Assignment#3

Session 3
Date: 22nd jan,2013

Assignment 1A
Based on the groove and mileage data: mileage is affected by groove.
Fit lm and comment on the applicability of lm
Plot 
      a) Res vs independent variable
      b) Sres vs Independent variable
      c) qqplot and add a qqline.


Solution:





As the residual plot is not a random but shows somewhat a parabolic pattern so it can be stated that linear model is not applicable in the case.

Assignment 1B
Based on alpha pluto data: pluto is dependent variable and alpha is the independent variable.
Fit lm and comment on the applicability of lm
      a) Plot Res vs independent variable

Output:


b) Plot Sres vs independent variable

Output:


Since the above plot does not show any pattern and random in nature so we can safely apply the linear model.

c) qqplot and qqline

Output:



Assignment 2

Based on the chair type and comfort level data: Determine whether the comfort level given by all the types of chairs are same using the ANOVA technique.


Output:


As seen from the solution the p value comes out to be 0.687,which is greater than 5%,our confidence interval of 95%.So we can not reject the null hypothesis.

Tuesday, 15 January 2013

Business Application IT Lab

IT Business Application lab Assignment#2

Session 2:
Date:15th Jan,2013

Today we have learnt about creation,inverse,transpose and multiplication of matrices.Then we moved on to
regression and residual analysis by taking NSE historical data for NIFTY index for a certain period.Finally we had an introductory idea about how to plot normally distributed curve.


Assignment 1: 
Create two matrices of say size 3 X 3 and select the column 1 from one matrix and column 3 from second matrix. After selecting the columns in objects say x1 and x1  merge these two columns using cbind to create a new matrix .

Solution:

To create a matrix:
x <- c[1:9]
dim(x) <- c(3,3)

y <- c[10:18]
dim(y) <- c(3,3)

To select a column
z1 <- x[ ,3]
z2 <- y[ ,2]

z3<- cbind(z1,z2)

Output:




Assignment 2:

Multiply both the matrices.

Solution:

z <- x %*% y

Output:



Assignment 3:

Read historical data of NIFTY indices from NSE for the period 1st Dec 2012 to 31st Dec 2012. Find regression and residuals


Solution:

To read the csv file:

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

For finding the regression and residuals the following commands are used

reg <- lm(High ~ Open , data = nse)
residuals(reg)

Output:


Assignment 4:

Generate a normal distribution data and plot it.

Solution:

For creating the ND following commands are used:

x<-rnorm(40,0,1)
y<-dnorm(x)

For plotting the data

plot(x,y)

Output:

 


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!!!