lab6 solutions

lab6 solutions - p <- pnorm(xbar, mean=mu0,...

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

View Full Document Right Arrow Icon
### 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) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

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

Ask a homework question - tutors are online