Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Confidence Intervals & Hypothesis Tests: Z-Test Function & Application to 3 Populations, Study Guides, Projects, Research of Mathematics

A project on confidence intervals and hypothesis tests using r. The project involves creating an r function, z.test, which performs a z-test for the mean and generates a confidence interval. Three populations are considered: normal distribution with mean 10 and standard deviation 2, binomial distribution with n = 5 and p = 0.1, and quebec birth data. The project includes performing hypothesis tests and calculating confidence intervals for each population, as well as comparing observed significance levels to nominal significance levels.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/16/2009

koofers-user-xgo
koofers-user-xgo 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Confidence Intervals & Hypothesis Tests: Z-Test Function & Application to 3 Populations and more Study Guides, Projects, Research Mathematics in PDF only on Docsity! Project 6 Confidence Intervals and Tests of hypotheses Problem 1. We begin this project by writing an R function which we call z.test that inputs a set of data and performs a z test for the mean and produces a two-sided confidence interval. Specifically, z.test will have the following input and output. Input: A vector (call it x) containing the data A string variable (call it alternative) that inputs the form of the alternative: ‘g’ for , ‘l’ for , and ‘t’ for two sided tests with . [Default: alternative = ‘t’] A variable (call it mu) containing the value of in the null hypothesis . [Default: mu = 0] A variable (call it conf.level) that gives the confidence level of the confidence interval desired. [Default: conf.level = 0.95] Output: Statistic: the value of the z statistic Pvalue: the p-value for the test Lconf: the lower limit of the confidence interval Uconf: the upper limit of the confidence interval A normal quantile plot of the data Consider the following three (population) sources from which we take samples: 1. Data Generated from a normal with mean 10 and standard deviation 2. 2. Data generated from Binomial with n = 5, and p= 0.1. 3. Quebec Birth Data: Number of daily births in Quebec from January 1, 1977 to December 31, 1990. Problem 2: For each of the above populations perform the following steps: a) Obtain the population mean, call it . b) Take a sample of size 5 from the population and test the hypothesis versus . Repeat this 5000 times, and determine the proportion of times that you reject the null hypothesis at 5% level (this is called the observed significance level). Compare this value to the 5% level (called the nominal significance level) and comment, c) Repeat (b) using 10% significance level. d) Compute s 99% confidence interval for and determine what proportion of the intervals contain the population mean Comment on the proportions that you obtain. Problem 3: Repeat problem 2 with the modification that in part (b), take a sample of size 50 rather than a sample of size 5.