Saturday 30 March 2013

3D graph


3D Graph plotting in R


Assignment 1:

Create 3 vectors, x, y, z and choose any random values for them, ensuring they are of equal length, bind them together.Create 3 dimensional plots of the same.

Data Set Creation Commands and DataSet :




Normal Plot:   plot3d(T[, 1:3])


Colour Plot: plot3d(T[, 1:3], col = rainbow(1000))


Color Plot of spheres:  plot3d(T[, 1:3], col = rainbow(1000), type = 's')



Assignment 2:

Choose 2 random variables
Create 3 plots:
1. X-Y
2. X-Y|Z (introducing a variable z and cbind it to z and y with 5 diff categories)
3. Color code and draw the graph
4. Smooth and best fit line for the curve


Data set creation for two random variables and then introducing third variable z


Plots:

>qplot(x,y)

>qplot(x,z)



Semi-transparent plot

> qplot(x,z, alpha=I(2/10))


Colour plot

> qplot(x,y, color=z)




 Logarithmic colour plot

> qplot(log(x),log(y), color=z)



Best Fit and Smooth curve using "geom"

> qplot(x,y,geom=c("path","smooth"))


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


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

Saturday 23 March 2013

Infographics tool : Piktochart


My Profile created with Piktochart :


Why Piktochart?
                       Ease of use (for me it took less than 30 min )
                       Wide variety of themes
                       Rich toolbox
                      Theme customization
                       Easy sharing

1) Ease of use :
The key here is taking the easy route – editing an existing layout/theme.
If you choose this route, you can go ahead and choose a theme for your infographic. If you’re a basic user, you’ll only have five themes or so to choose from. Pro users get over a hundred themes, but more on that later.



2) Wide variety of themes :
There are various inbuilt themes related to various ideas like entertainment, science, art, people, countries, flow diagrams and so many other. In paid version in all there are more than 200 inbuilt themes .

3) Rich toolbox :
After choosing the theme, you can also choose a different color scheme from the side panel. Then, all you have to do is edit the existing content in order to create your own unique infographic. Click the shape/object you wish to edit (or double click to edit text), then use the properties toolbar up above to edit the object. You can rotate objects, alter the layer/opacity, resize, move, change the color and edit the text attributes from this property bar, allowing you to customize the existing theme for your own purposes.



4) Theme customization
If you don’t like inbuilt theme then you can design your theme right from scratch. First clear the blank canvas  after this you can start inserting the elements of your infographic. There are three object types to insert – shapes, graphics and theme graphics. The shapes include everything from basic shapes like squares and circles to complex shapes like thumbs up symbols and utensil symbols. The graphics section includes images like maps and popular website icons. The theme graphics section contains images specific to the theme you’ve chosen, contributing to a cohesive overall look.
To add an element, simply drag and drop it onto your canvas. This method also works to add text – simply select the text section, choose which section of the infographic your text is for (e.g. header or footer), then drag and drop a text box. Click on any added objects to edit them using the properties toolbar, as described in the previous section. You can also add charts and graphs from CSV files.

5) Easy sharing
We can save the theme in JPG and HTML file format. Also we can post the infographics on our social networking sites like facebook and Twitter.


Problems with Piktochart :

Though it has number of inbuilt themes available only few are allowed for free users.

Thursday 14 March 2013

Assignment 8 : Panel Data Analysis-12March

                                                          Assignment 8 : Panel Data Analysis

Do Panel Data Analysis of "Produc" data analyzing  on three types of model :
      1) Pooled affect model
      2) Fixed affect model
      3) 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"))

1) 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


2) 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


3) 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.


Roll No :12BM60092
Name :   Rahul Mali.