economyindicator <- read.csv("E:/Documents/internship-R/economyindicator.csv")
View(economyindicator)
library(psych)
## Warning: package 'psych' was built under R version 3.4.3
summary(economyindicator)
##         YEAR   Fiscal.Deficit  CPI..Average.    Inflation...WPI..Average.
##  1999-2000:1   Min.   :2.540   Min.   : 3.400   Min.   :3.300            
##  2000-01  :1   1st Qu.:4.055   1st Qu.: 3.950   1st Qu.:4.175            
##  2001-02  :1   Median :5.340   Median : 5.250   Median :6.000            
##  2002-03  :1   Mean   :4.953   Mean   : 6.357   Mean   :5.964            
##  2003-04  :1   3rd Qu.:5.862   3rd Qu.: 8.750   3rd Qu.:7.650            
##  2004-05  :1   Max.   :6.460   Max.   :13.000   Max.   :9.600            
##  (Other)  :8                                                             
##  Gross.Fixed.Capital.Formation Consumption....of.GDP. Capital.Formation
##  Min.   : 0.000                Min.   :67.10          Min.   :22.30    
##  1st Qu.: 5.825                1st Qu.:68.08          1st Qu.:25.70    
##  Median : 7.450                Median :69.20          Median :34.48    
##  Mean   : 9.550                Mean   :71.72          Mean   :31.58    
##  3rd Qu.:13.750                3rd Qu.:76.65          3rd Qu.:35.59    
##  Max.   :20.700                Max.   :79.40          Max.   :38.11    
##                                                                        
##  Saving.Investment.Gap Gross.Domestic.Saving Bank.Credit.Growth
##  Min.   :23.77         Min.   :-4.8900       Min.   :15.30     
##  1st Qu.:26.70         1st Qu.:-2.8725       1st Qu.:17.00     
##  Median :31.91         Median :-1.2400       Median :17.85     
##  Mean   :30.64         Mean   :-1.4014       Mean   :21.29     
##  3rd Qu.:33.63         3rd Qu.:-0.5125       3rd Qu.:23.35     
##  Max.   :36.82         Max.   : 2.8600       Max.   :37.00     
##                                                                
##  Bank.Deposit.growth
##  Min.   :13.00      
##  1st Qu.:16.00      
##  Median :16.55      
##  Mean   :17.76      
##  3rd Qu.:19.52      
##  Max.   :24.00      
## 
describe(economyindicator)
##                               vars  n  mean   sd median trimmed  mad   min
## YEAR*                            1 14  7.50 4.18   7.50    7.50 5.19  1.00
## Fiscal.Deficit                   2 14  4.95 1.17   5.34    5.03 0.97  2.54
## CPI..Average.                    3 14  6.36 2.96   5.25    6.05 2.30  3.40
## Inflation...WPI..Average.        4 14  5.96 2.11   6.00    5.88 2.74  3.30
## Gross.Fixed.Capital.Formation    5 14  9.55 5.84   7.45    9.42 5.71  0.00
## Consumption....of.GDP.           6 14 71.72 4.87  69.20   71.47 2.82 67.10
## Capital.Formation                7 14 31.58 5.63  34.47   31.81 3.24 22.30
## Saving.Investment.Gap            8 14 30.64 4.09  31.91   30.70 3.56 23.77
## Gross.Domestic.Saving            9 14 -1.40 2.01  -1.24   -1.47 1.90 -4.89
## Bank.Credit.Growth              10 14 21.29 6.56  17.85   20.48 3.78 15.30
## Bank.Deposit.growth             11 14 17.76 3.53  16.55   17.63 2.82 13.00
##                                 max range  skew kurtosis   se
## YEAR*                         14.00 13.00  0.00    -1.46 1.12
## Fiscal.Deficit                 6.46  3.92 -0.58    -1.03 0.31
## CPI..Average.                 13.00  9.60  0.72    -0.74 0.79
## Inflation...WPI..Average.      9.60  6.30  0.20    -1.49 0.56
## Gross.Fixed.Capital.Formation 20.70 20.70  0.28    -1.12 1.56
## Consumption....of.GDP.        79.40 12.30  0.56    -1.60 1.30
## Capital.Formation             38.11 15.81 -0.48    -1.62 1.51
## Saving.Investment.Gap         36.82 13.05 -0.36    -1.38 1.09
## Gross.Domestic.Saving          2.86  7.75  0.23    -0.53 0.54
## Bank.Credit.Growth            37.00 21.70  1.08    -0.08 1.75
## Bank.Deposit.growth           24.00 11.00  0.58    -1.07 0.94

BOXPLOT

boxplot(economyindicator$Fiscal.Deficit, main="Boxplot for fiscal deficit of India from 1999-2000 to 2012-13", horizontal = TRUE)

library(car)
## Warning: package 'car' was built under R version 3.4.3
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplot(economyindicator$CPI..Average., economyindicator$Fiscal.Deficit, main="Scatterplot of Fiscal deficit and CPI Average", ylab = "Fiscal Deficit", xlab = "CPI Average")

library(car)
scatterplot(economyindicator$Inflation...WPI..Average., economyindicator$Fiscal.Deficit, main= "Scatterplot of Fiscal Deficit and WPI Average", ylab = "Fiscal Deficit", xlab = "WPI Average")

plot(jitter(economyindicator$Fiscal.Deficit),jitter(economyindicator$Gross.Fixed.Capital.Formation),main="Fiscal Deficit vs gross fixed capital formation",ylab = "Fiscal Deficit ", xlab="GFCF")

library(lattice)
## Warning: package 'lattice' was built under R version 3.4.3
scatterplot(Saving.Investment.Gap~Fiscal.Deficit, data = economyindicator,main="Fiscal Deficit vs Saving Investment gap",ylab = "Fiscal Deficit ", xlab="Saving Invst gap" )

library(car)
scatterplotMatrix(
    economyindicator[
        ,c("Fiscal.Deficit","Gross.Domestic.Saving","Bank.Credit.Growth","Bank.Deposit.growth")], 
     spread=FALSE, smoother.args=list(lty=2),
   main="Scatter Plot Matrix", diagonal = "histogram")

library(corrgram)
## Warning: package 'corrgram' was built under R version 3.4.3
temp<-data.frame(economyindicator$Fiscal.Deficit, economyindicator$Bank.Credit.Growth, economyindicator$Bank.Deposit.growth, economyindicator$CPI..Average.,economyindicator$Gross.Fixed.Capital.Formation,economyindicator$Inflation...WPI..Average.,economyindicator$Consumption....of.GDP.,economyindicator$Capital.Formation,economyindicator$Saving.Investment.Gap,economyindicator$Gross.Domestic.Saving)
 corrgram(temp, order=TRUE, lower.panel=panel.shade,
          upper.panel=panel.pie, text.panel=panel.txt,
          main="Corrgram of Fiscal Deficit")

t.test(economyindicator$Fiscal.Deficit,economyindicator$Bank.Credit.Growth)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Bank.Credit.Growth
## t = -9.1648, df = 13.832, p-value = 2.997e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -20.15948 -12.50624
## sample estimates:
## mean of x mean of y 
##  4.952857 21.285714
t.test(economyindicator$Fiscal.Deficit,economyindicator$Bank.Deposit.growth)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Bank.Deposit.growth
## t = -12.871, df = 15.842, p-value = 8.389e-10
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -14.91492 -10.69365
## sample estimates:
## mean of x mean of y 
##  4.952857 17.757143
t.test(economyindicator$Fiscal.Deficit,economyindicator$CPI..Average.)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$CPI..Average.
## t = -1.6506, df = 17.001, p-value = 0.1172
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -3.199294  0.390723
## sample estimates:
## mean of x mean of y 
##  4.952857  6.357143
t.test(economyindicator$Fiscal.Deficit,economyindicator$Inflation...WPI..Average.)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Inflation...WPI..Average.
## t = -1.5695, df = 20.381, p-value = 0.1319
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2.3540384  0.3311813
## sample estimates:
## mean of x mean of y 
##  4.952857  5.964286
t.test(economyindicator$Fiscal.Deficit,economyindicator$Gross.Fixed.Capital.Formation)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Gross.Fixed.Capital.Formation
## t = -2.8867, df = 14.05, p-value = 0.01192
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.011569 -1.182716
## sample estimates:
## mean of x mean of y 
##  4.952857  9.550000
t.test(economyindicator$Fiscal.Deficit,economyindicator$Consumption....of.GDP.)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Consumption....of.GDP.
## t = -49.866, df = 14.508, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -69.63094 -63.90621
## sample estimates:
## mean of x mean of y 
##  4.952857 71.721429
t.test(economyindicator$Fiscal.Deficit,economyindicator$Capital.Formation)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Capital.Formation
## t = -17.32, df = 14.129, p-value = 6.489e-11
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -29.92492 -23.33508
## sample estimates:
## mean of x mean of y 
##  4.952857 31.582857
t.test(economyindicator$Fiscal.Deficit,economyindicator$Saving.Investment.Gap)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Saving.Investment.Gap
## t = -22.564, df = 15.127, p-value = 4.62e-13
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -28.11189 -23.26239
## sample estimates:
## mean of x mean of y 
##  4.952857 30.640000
t.test(economyindicator$Fiscal.Deficit,economyindicator$Gross.Domestic.Saving)
## 
##  Welch Two Sample t-test
## 
## data:  economyindicator$Fiscal.Deficit and economyindicator$Gross.Domestic.Saving
## t = 10.219, df = 20.966, p-value = 1.347e-09
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  5.061000 7.647571
## sample estimates:
## mean of x mean of y 
##  4.952857 -1.401429
reg<-lm(Fiscal.Deficit~CPI..Average. + Inflation...WPI..Average. + Gross.Fixed.Capital.Formation + Consumption....of.GDP. + Capital.Formation + Saving.Investment.Gap + Gross.Domestic.Saving  +Bank.Credit.Growth  + Bank.Deposit.growth, data = economyindicator)
summary(reg)
## 
## Call:
## lm(formula = Fiscal.Deficit ~ CPI..Average. + Inflation...WPI..Average. + 
##     Gross.Fixed.Capital.Formation + Consumption....of.GDP. + 
##     Capital.Formation + Saving.Investment.Gap + Gross.Domestic.Saving + 
##     Bank.Credit.Growth + Bank.Deposit.growth, data = economyindicator)
## 
## Residuals:
##         1         2         3         4         5         6         7 
##  0.200293 -0.102711 -0.077102 -0.269711  0.195366  0.016700  0.310436 
##         8         9        10        11        12        13        14 
## -0.320443 -0.249713  0.494763  0.027760 -0.001438 -0.303701  0.079502 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                   44.68395   16.59532   2.693   0.0545 .
## CPI..Average.                  0.30457    0.13522   2.252   0.0874 .
## Inflation...WPI..Average.     -0.21003    0.10964  -1.916   0.1279  
## Gross.Fixed.Capital.Formation -0.03228    0.08203  -0.394   0.7140  
## Consumption....of.GDP.        -0.32495    0.15851  -2.050   0.1097  
## Capital.Formation             -0.13107    0.20578  -0.637   0.5588  
## Saving.Investment.Gap         -0.39467    0.29518  -1.337   0.2522  
## Gross.Domestic.Saving         -0.01570    0.14610  -0.107   0.9196  
## Bank.Credit.Growth             0.02143    0.03285   0.652   0.5498  
## Bank.Deposit.growth           -0.05892    0.06856  -0.859   0.4386  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4397 on 4 degrees of freedom
## Multiple R-squared:  0.9569, Adjusted R-squared:   0.86 
## F-statistic: 9.869 on 9 and 4 DF,  p-value: 0.02076