[IPSUR-commits] r134 - pkg/IPSUR/inst/doc
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 9 20:38:29 CET 2010
Author: gkerns
Date: 2010-01-09 20:38:29 +0100 (Sat, 09 Jan 2010)
New Revision: 134
Modified:
pkg/IPSUR/inst/doc/IPSUR.Rnw
Log:
fixed an error
Modified: pkg/IPSUR/inst/doc/IPSUR.Rnw
===================================================================
--- pkg/IPSUR/inst/doc/IPSUR.Rnw 2010-01-09 18:21:41 UTC (rev 133)
+++ pkg/IPSUR/inst/doc/IPSUR.Rnw 2010-01-09 19:38:29 UTC (rev 134)
@@ -11076,8 +11076,9 @@
The outputted MLEs are shown above, and \inputencoding{latin9}\lstinline[basicstyle={\ttfamily},showstringspaces=false]!mle!\inputencoding{utf8}
even gives us estimates for the standard errors of $\hat{\mu}$ and
$\hat{\sigma}^{2}$ (which were obtained by inverting the numerical
-Hessian matrix at the optima; see Appendix BLANK). Let us check how
-close the numerical MLEs came to the theoretical MLEs:
+Hessian matrix at the optima; see Appendix \ref{sec:Multivariable-Calculus}).
+Let us check how close the numerical MLEs came to the theoretical
+MLEs:
<<>>=
mean(x)
@@ -11200,9 +11201,68 @@
\mbox{if }1-\alpha\mbox{ increases, then the confidence interval gets \emph{WIDER}.}\end{equation}
\end{rem}
\begin{example}
-Give some data with $X_{1}$, $X_{2}$, \ldots{}, $X_{n}$ an $SRS(n)$
-from a $\mathsf{norm}(\mathtt{mean}=\mu,\,\mathtt{sd}=\sigma)$ distribution.
-Maybe small sample?\end{example}
+\textbf{Results from an Experiment on Plant Growth.\label{exa:plant-one-samp-z-int}}
+The \inputencoding{latin9}\lstinline[basicstyle={\ttfamily},showstringspaces=false]!PlantGrowth!\inputencoding{utf8}
+data frame gives the results of an experiment to measure plant yield
+(as measured by the weight of the plant). We would like to a 95\%
+confidence interval for the mean weight of the plants. Suppose that
+we know from prior research that the true population standard deviation
+of the plant weights is $0.7$~g.
+
+The parameter of interest is $\mu$, which represents the true mean
+weight of the population of all plants of the particular species in
+the study. We will first take a look at a stemplot of the data:
+\end{example}
+<<>>=
+library(aplpack)
+with(PlantGrowth, stem.leaf(weight))
+@
+
+The data appear to be approximately normal with no extreme values.
+The data come from a designed experiment, so it is reasonable to suppose
+that the observations constitute a simple random sample of weights%
+\footnote{Actually we will see later that there is reason to believe that the
+observations are simple random samples from three distinct populations.
+See Section \ref{sec:Analysis-of-Variance}.%
+}. We know the population standard deviation $\sigma=0.70$ from prior
+research. We are going to use the one-sample $z$-interval.
+
+<<keep.source = TRUE>>=
+dim(PlantGrowth) # sample size is first entry
+with(PlantGrowth, mean(weight))
+qnorm(0.975)
+@
+
+We find the sample mean of the data to be $\xbar=5.073$ and $z_{\alpha/2}=z_{0.025}\approx1.96$.
+Our interval is therefore\[
+\xbar\pm z_{\alpha/2}\frac{\sigma}{\sqrt{n}}=5.073\pm1.96\cdot\frac{0.70}{\sqrt{30}}\]
+which is approximately the interval $[4.823,\,5.323]$. In conclusion,
+we are 95\% confident that the true mean weight $\mu$ of all plants
+of this species lies somewhere between 4.823~g and 5.323~g, that
+is, we are 95\% confident that the interval $[4.823,\,5.323]$ covers
+$\mu$. See Figure
+
+%
+\begin{figure}
+\begin{centering}
+<<echo = FALSE, fig=true, height = 6, width = 6>>=
+library(TeachingDemos)
+plot(z.test(PlantGrowth$weight, stdev = 0.70), "Conf")
+@
+\par\end{centering}
+
+\caption{Confidence interval plot for the \texttt{PlantGrowth} data\label{fig:plant-z-int-plot}}
+The graph was generated by computing a \texttt{z.test} from the \texttt{TeachingDemos}
+package, storing the resulting \texttt{htest} object, and plotting
+it with \texttt{plot.htest} from the \texttt{IPSUR} package.
+\end{figure}
+
+
+
+\begin{example}
+yieldPlantGrowth Give some data with $X_{1}$, $X_{2}$, \ldots{},
+$X_{n}$ an $SRS(n)$ from a $\mathsf{norm}(\mathtt{mean}=\mu,\,\mathtt{sd}=\sigma)$
+distribution. Maybe small sample?\end{example}
\begin{enumerate}
\item What is the parameter of interest? in the context of the problem.
Give a point estimate for $\mu$.
@@ -11211,7 +11271,7 @@
\item Calculate the interval.
\item Draw the conclusion.
\end{enumerate}
-Draw a picture here.
+hdf
What if $\sigma$ is unknown? We instead use the interval\begin{equation}
\Xbar\pm z_{\alpha/2}\frac{S}{\sqrt{n}},\end{equation}
@@ -11280,6 +11340,8 @@
\subsection{How to do it with \textsf{R}}
+We can do Example \ref{exa:plant-one-samp-z-int} with The
+
library(HH)
normal.and.t.dist(obs.mean = 56.8, std.dev = 2, n = 10, alpha.right
@@ -11920,7 +11982,8 @@
# this is the example from the help file
nheads <- rbinom(1, size = 100, prob = 0.45)
prop.test(x = nheads, n = 100, p = 0.50, alternative = "two.sided", conf.level = 0.95, correct = TRUE)
-prop.test(x = nheads, n = 100, p = 0.50, alternative = "two.sided", conf.level
+prop.test(x = nheads, n = 100, p = 0.50, alternative = "two.sided", conf.level = 0.95, correct = FALSE)
+@
%
\begin{figure}
More information about the IPSUR-commits
mailing list