I want to eventually make a macro using ggplot. I have successfully gotten the plot to run but when I try to generalize it the entire x axis is not being plotted. I am not sure why. Can someone explain how to correct this? Thank you.
#upper tail working
ggplot(data.frame(x = c(-4, 4)), aes(x)) +
stat_function(fun = dt, args =list(df =23)) +
stat_function(fun = dt, args =list(df =23),
xlim = c(1.78,4),
geom = "area")
#upper tail working but partial x axis is plotted
xLB=-4;
xUB= 4;
alpha=.10;
df=13;
tcrit <-qt(1-alpha,df);
tcrit<- round(tcrit,4)
tcrit2<-qt(1-alpha/2,df);
tcrit2<-round(tcrit2,4)
tcrit
tcrit2
ggplot(data.frame(x = c(xLB, xUB)), aes(x)) +
stat_function(fun = dt, args = list(df)) +
stat_function(fun = dt, args = list(df),
xlim = c(tcrit,xUB),
geom = "area")