# lab6 solutions - p< pnorm(xbar mean=mu0 sd=sigma/sqrt(n...

This preview shows page 1. Sign up to view the full content.

### lab6 ## one-sided, Ha: mu > mu0 p.val <- function(xbar, n, sigma, mu0) { z <- (xbar - mu0)/(sigma/sqrt(n)) p <- pnorm(z, lower.tail=FALSE) print(p) } # or p.val <- function(xbar, n, sigma, mu0) { p <- pnorm(xbar, mean=mu0, sd=sigma/sqrt(n), lower.tail=FALSE) print(p) } ## one-sided, Ha: mu < mu0 p.val <- function(xbar, n, sigma, mu0) { z <- (xbar - mu0)/(sigma/sqrt(n)) p <- pnorm(z) print(p) } # or p.val <- function(xbar, n, sigma, mu0) {
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: p <- pnorm(xbar, mean=mu0, sd=sigma/sqrt(n)) print(p) } ## two-sided p.val <- function(xbar, n, sigma, mu0) { z <- (xbar - mu0)/(sigma/sqrt(n)) p <- 2*pnorm(abs(z), lower.tail=FALSE) print(p) } # or p.val <- function(xbar, n, sigma, mu0) { if (xbar > mu0) p <- 2*pnorm(xbar, mean=mu0, sd=sigma/sqrt(n), lower.tail=FALSE) else p <- 2*pnorm(xbar, mean=mu0, sd=sigma/sqrt(n)) print(p) }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online