Thursday, 28 March 2013

Plotting in R

Session 10, March 26th, 2013

Assignment 1: 

Create 3 vectors x,y,z and choose any random values for them.

T<-cbind(x,y,z)

Create 3-dimentional plot of the same



plot3d(T)



 plot3d(T,col=rainbow(1000))


plot3d(T,col=rainbow(1000),type='s')


Assignment 2 : 

Create 2 random variables x,y & create a few plots showing
  • X-Y
  • X-Y|Z ( Introduce a variable z and cbind it to z and y with 5 different categories ... Hint : ?factor)
  • Color code and draw the graph
  • Smooth and fit line for the curve


qplot(x,y)



qplot(x,z)


 qplot(x,z,alpha=I(1/10))


qplot(x,z,alpha = I(1/30))


qplot(x,y,geom=c("boxplot", "jitter"))



qplot(x,y,geom=c("point", "smooth"))


qplot(x,y,colour=z)


qplot(log(x),log(y), colour=z)



Saturday, 23 March 2013

ITBAL : 9th Session



Want to Know your FB Page better : Check out Wolfram Alpha


Wolfram Alpha is a computational knowledge engine, which by doing dynamic computations based on a vast collection of built-in data, algorithms, and methods generates a detailed Facebook report complete with statistical insights about how many links, photos and updates you ever posted on your page last year.


The Wolfram Alpha Facebook report does some very basic things, like adding to the information it learns from Facebook, such as noting the population of the city you live in or calculating the number of months and days to your next birthday. Then it offers calculations on your Facebook usage. What words do you use most frequently? How often do you upload photos or post links–and how has that changed over time? How many characters is your average post? It tells you your most liked and most commented-on posts, as well as those who most frequently share and comment on your posts.


1. Connect with facebook, sign in for free, and get unique personalized information and  analysis on your social data.


2.  What do you frequently talk about on facebook and most liked post and photos.


                      3.  When do you use facebook? When you are most active?




4. Where are your friends?


7. Clustering of your friends

8. Who plays the special role in your network?

This software requires you to login to facebook and only then gathers information, thereby respecting the privacy the privacy settings also.

Friday, 15 March 2013

Panel Data Analysis

QUESTION 1

Do Panel Data Analysis of "Produc" data analyzing  on three types of model :
   a.   Pooled affect model
   b.   Fixed affect model
   c.   Random affect model

Determine which model is the best by using functions:
       pFtest : Fixed vs Pooled
       plmtest : Pooled vs Random
       phtest: Random vs Fixed

Pooled Model

Command: 
pool<-plm( log(pcap) ~ log(hwy) +  log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp)
, data= Produc, model = ("pooling"), index = c("state","year"))



Fixed Model

Command: 
fixed<-plm( log(pcap) ~ log(hwy) +  log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp)
, data= Produc, model = ("within"), index = c("state","year"))


 Random Model

Command: 
random<-plm( log(pcap) ~ log(hwy) +  log(water) + log(util) + log(pc) + log(gsp) + log(emp) + log(unemp)
, data= Produc, model = ("random"), index = c("state","year"))




Pooled vs Fixed 

Null Hypothesis: Pooled Model
Alternate Hypothesis : Fixed Model


Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Model is better than Pooled Model

Pooled vs Random 

Null Hypothesis: Pooled Model
Alternate Hypothesis: Random Model



Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Random Model is better than Pooled Model


Random vs Fixed 

Null Hypothesis: No Correlation . Random Model
Alternate Hypothesis: Fixed Model



Since the p value is negligible so we reject the Null Hypothesis and hence Alternate hypothesis is accepted which is to accept Fixed Model.

Conclusion: 

 So after making all the comparisons we come to the conclusion that Fixed Model is best suited to do the panel data analysis for "Produc" data set.
Hence , we conclude that within the same id i.e. within same "state" there is no variation.