library(readxl)
ejemplo_regresion <- read_excel("e:/Econometria 2020/Presentaciones Econometria/ejemplo_regresion.xlsx")
modelo_estimado_1<-lm(formula = Y~X1+X2,data = ejemplo_regresion)
library(fastGraph)
## Warning: package 'fastGraph' was built under R version 4.0.5
options(scipen = 99999)
#crear matriz de coef. desv. p_value
Coef_modelo<-summary(modelo_estimado_1)$coefficients
t_values<-Coef_modelo[,"t value"]
etiquetas<-names(t_values)
#Gráficas Pruebas t 
for(j in 2:3){
  tc<-t_values[j]
  t_VC<-
  shadeDist( c(-tc, tc ), "dt", 13,col=c("black","red"),sub=paste("Parámetro de la Variable:",etiquetas[j]))
  print(confint(modelo_estimado_1,parm = j,level = 0.95))
}

##        2.5 %    97.5 %
## X1 0.1219744 0.3524205

##            2.5 %        97.5 %
## X2 -0.0003155438 -0.0001826148
#Gráfica Prueba F
F_Anova<-summary(modelo_estimado_1)$fstatistic[1]
gl_num<-summary(modelo_estimado_1)$fstatistic[2]
gl_den<-summary(modelo_estimado_1)$fstatistic[3]
F_VC<-qf(0.95,gl_num,gl_den,lower.tail = TRUE)
shadeDist(xshade = F_Anova,"df",gl_num,gl_den,lower.tail = FALSE, col=c("black","red"),
          sub=paste("VC:",F_VC," ","Fc:",F_Anova))

library(fastGraph)
shadeDist(qchisq(0.05,25,lower.tail = FALSE),ddist = 'dchisq',parm1 = 25,lower.tail = FALSE)

shadeDist(23,ddist = 'dchisq',parm1 = 25,lower.tail = FALSE,col=c('black','orange'),sub=paste(c(qchisq(0.05,25,lower.tail = FALSE))))

shadeDist()