In: Computer Science
Financial Condition of Banks (5 points). The file Banks.csv includes data on a sample of 20 banks. The “Financial Condition” column records the judgment of an expert on the financial condition of each bank. This outcome variable takes one of two possible values—weak or strong—according to the financial condition of the bank. The predictors are two ratios used in the financial analysis of banks: TotLns&Lses/Assets is the ratio of total loans and leases to total assets and TotExp/Assets is the ratio of total expenses to total assets. The target is to use the two ratios for classifying the financial condition of a new bank.
data set
https://drive.google.com/file/d/1pnIK-EKkkynPY1sp_LuK42JdORBdbDn6/view?usp=sharing
The given data set has Bank data with 5 columns and 20 rows. The columns are Obs, Financial Condition(FC), TotCap/Assets(TCA), TotExp/Assets(TEA), TotLns&Lses/AssetsFinca(TLLA).
Step 1: Load the Dataset
bankdata <- read.csv("folder path\\bank.csv")
Step 2 Run a Logicstic Regression model
FC.data = glm(formula = FC ~ TCA + TEA + TLLA, data = bankdata, family = binomial)
Step 3: Print result
summary(FC.data)
Result:
Call: glm(formula = FC ~ TCA + TEA + TLLA, family = binomial, data = bankdata) Deviance Residuals: Min 1Q Median 3Q Max -3.267e-05 -2.100e-08 0.000e+00 2.100e-08 3.358e-05 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -686.10 551916.96 -0.001 0.999 TCA -13.71 11273.27 -0.001 0.999 TEA 3353.22 2938727.45 0.001 0.999 TLLA 677.51 624215.61 0.001 0.999 (Dispersion parameter for binomial family taken to be 1) Null deviance: 2.7726e+01 on 19 degrees of freedom Residual deviance: 2.6647e-09 on 16 degrees of freedom AIC: 8 Number of Fisher Scoring iterations: 25
confint() function is Confidence Intervals for Model Parameters.
Computes confidence intervals for one or more parameters in a fitted model. The default method can be called directly for comparison with other methods.
confint.default(FC.data) 2.5 % 97.5 % (Intercept) -1082423.47 1081051.27 TCA -22108.91 22081.49 TEA -5756446.74 5763153.19 TLLA -1222762.60 1224117.62 Analysis of Variance also termed as ANOVA. It is procedure followed by statisticans to check the potential difference between scale-level dependent variable by a nominal-level variable having two or more categories. > anova(FC.data) Analysis of Deviance Table Model: binomial, link: logit Response: FC Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev NULL 19 27.726 TCA 1 8.0288 18 19.697 TEA 1 8.6694 17 11.028 TLLA 1 11.0278 16 0.000 The below function is for Chi Square Test performed on the model. > anova(FC.data,test = "Chisq") Analysis of Deviance Table Model: binomial, link: logit Response: FC Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(>Chi) NULL 19 27.726 TCA 1 8.0288 18 19.697 0.0046040 ** TEA 1 8.6694 17 11.028 0.0032361 ** TLLA 1 11.0278 16 0.000 0.0008976 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1