I'm trying to do the following problem,
Inside the function, two Shapiro-Wilk tests of normality are conducted separately for the two samples (note the normality assumption at the beginning of the problem). If one or both p-values are less than 0.05, a warning message is printed out explaining the situation.
but don't know how I could save the p-value to do something like
if(shap1.pval < 0.05) { warrning...etc}
Also would already having an if elseif staement within my function mess with this? Below is something I already have within the function I was told to make
if(alt== "two-sided") {
p.val<- 2*pf(test.stat, df1, df2, lower.tail = FALSE)
lower.bound <- (x1.variance/x2.variance) * lower.crit
upper.bound <- (x1.variance/x2.variance) * upper.crit
}
else if(alt == "greater"){
p.val<- pf(test.stat, df1, df2, lower.tail = FALSE)
lower.bound <- (x1.variance/x2.variance) * lower.crit
upper.bound <- (x1.variance/x2.variance) * upper.crit
}