Class assignment: O_Ring data

Student name: Udita Chatterjee

Some required tools for loglog links #library(remotes) #install_github(“trobinj/trtools”)

data1=read.csv("O_ring_data.csv")
data1
library(viridis)
## Warning: package 'viridis' was built under R version 4.0.5
## Loading required package: viridisLite
## Warning: package 'viridisLite' was built under R version 4.0.5
library(hrbrthemes)
## Warning: package 'hrbrthemes' was built under R version 4.0.5
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
##       Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
##       if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
ggplot(data=data1,aes(x=data1$Temperature,y=data1$No.of.Damages))+geom_point(alpha=0.7,size=5,col="darkmagenta")+scale_size(range=c(0.1,24))+xlab("Temparature")+ylab("No of Damages")
## Warning: Use of `data1$Temperature` is discouraged. Use `Temperature` instead.
## Warning: Use of `data1$No.of.Damages` is discouraged. Use `No.of.Damages`
## instead.

ggplot(data=data1,aes(x=data1$Pressure,y=data1$No.of.Damages))+geom_point(alpha=0.7,size=5,col="deepskyblue3")+scale_size(range=c(1,24))+xlab("Pressure in Pound")+ylab("No of Damages")
## Warning: Use of `data1$Pressure` is discouraged. Use `Pressure` instead.
## Warning: Use of `data1$No.of.Damages` is discouraged. Use `No.of.Damages`
## instead.

1.Probit Model

model_probit=glm(data1$O.ring.failed.Y.N.~data1$Temperature+data1$Pressure,family=binomial(link=probit))

model_probit
## 
## Call:  glm(formula = data1$O.ring.failed.Y.N. ~ data1$Temperature + 
##     data1$Pressure, family = binomial(link = probit))
## 
## Coefficients:
##       (Intercept)  data1$Temperature     data1$Pressure  
##         12.681877          -0.202335           0.003253  
## 
## Degrees of Freedom: 22 Total (i.e. Null);  20 Residual
## Null Deviance:       26.4 
## Residual Deviance: 13.97     AIC: 19.97

2.C-log-log Model

model_cloglog=model_cloglog=glm(data1$O.ring.failed.Y.N.~data1$Temperature+data1$Pressure,family=binomial(link=cloglog))

model_cloglog
## 
## Call:  glm(formula = data1$O.ring.failed.Y.N. ~ data1$Temperature + 
##     data1$Pressure, family = binomial(link = cloglog))
## 
## Coefficients:
##       (Intercept)  data1$Temperature     data1$Pressure  
##         17.156923          -0.282666           0.004999  
## 
## Degrees of Freedom: 22 Total (i.e. Null);  20 Residual
## Null Deviance:       26.4 
## Residual Deviance: 13.53     AIC: 19.53

3.Logit_Model

model_logit=glm(data1$O.ring.failed.Y.N.~data1$Temperature+data1$Pressure,family=binomial(link=logit))

model_logit
## 
## Call:  glm(formula = data1$O.ring.failed.Y.N. ~ data1$Temperature + 
##     data1$Pressure, family = binomial(link = logit))
## 
## Coefficients:
##       (Intercept)  data1$Temperature     data1$Pressure  
##         21.843631          -0.350098           0.006007  
## 
## Degrees of Freedom: 22 Total (i.e. Null);  20 Residual
## Null Deviance:       26.4 
## Residual Deviance: 14.03     AIC: 20.03

Hence cloglog has smaller deviance than other canonical links.