# NormalAndTplot

From HH v3.1-8
0th

Percentile

##### Specify plots to illustrate Normal and t Hypothesis Tests or Confidence Intervals.

Specify plots to illustrate Normal and t Hypothesis Tests or Confidence Intervals.

Keywords
hplot
##### Usage
NormalAndTplot(mean0, ...)
## S3 method for class 'default':
NormalAndTplot(mean0=0,
mean1=NA,
xbar=NA,
sd=1, df=Inf, n=1,
xlim=c(-3, 3), ylim, alpha.right=.05, alpha.left=0,
float=TRUE, ntcolors="original",
digits=4, digits.axis=digits, digits.float=digits,
distribution.name=c("normal","z","t"),
type=c("hypothesis", "confidence"),
zaxis=FALSE, z1axis=FALSE,
cex.z=.5, cex.prob=.6, cex.top.axis=1,
main, xlab, ylab,
prob.labels=(type=="hypothesis"),
xhalf.multiplier=1,
cex.main=1,
## S3 method for class 'htest':
NormalAndTplot(mean0, type="hypothesis", xlim=NULL, ...,
xbar, sd, df, n, alpha.left, alpha.right, distribution.name, sub
## these input arguments sfter ... will be ignored
)
##### Arguments
mean0
Null hypothesis $mu_0$. When graphing a confidence interval, mean0 will be used for xbar should xbar itself have the value NA.
mean1
Alternative hypothesis $mu_1$.
xbar
Observed $\bar(x)$.
sd
Standard deviation $\sigma$ for normal-, or $s$ for $t$-distribution.
df
Degrees of freedom for $t$-distribution.
n
Number of observations.
main, xlab, ylab, xlim, ylim, sub
Standard xyplot arguments. Default values are constructed if these arguments are missing.
...
Additional xyplot arguments.
alpha.left, alpha.right
For type="hypothesis", the sum of these two numbers is the probability of the Type I Error $\alpha$. When both of these numbers are positive, there is a two-sided test. Note that it is not required that they be equal. If one of the numbers
float
Logical. If TRUE, then the probabilities $\alpha$, $\beta$, power, and $p$-values or the confidence value are displayed on the graph. If FALSE, these values are not displayed.
ntcolors
Vector of colors used in the graph. The default value is "original", which implies the ten colors c(col.alpha = "blue", col.notalpha = "lightblue", col.beta = "red", col.power = "pink", col.pvalue = "green", col.pvaluetransluce
digits.axis, digits.float, digits
digits.axis is the number of significant digits for the top axis. digits.float is the number of significant digits for the floating probability values on the graph. digits is a convenience argument to s
distribution.name
Name of distribution.
type
"hypothesis" for a Hypothesis Test graph, or "confidence" for a Confidence Interval graph.
z1axis, zaxis
Logical. Should the $z_1$-axis centered on $mu_1$ or the $z_0$-axis centered on $mu_0$ be displayed?
cex.z, cex.prob, cex.top.axis, cex.main
cex.z is the cex value for the $z$ and $z_1$ axes on the plot. cex.prob is the cex value for the floating probabilities on the graph. cex.top.axis is the cex value
tuning constant to create additional room above the graph for a larger cex.main to fit.
logical. If TRUE label the floating probability values with their name, such as $alpha$. If FALSE, then don't label them. The default is TRUE for type="hypothesis" and FALSE
 xhalf.multiplier Numerical tuning constant to control the width of the floating probability values. Empirically, we need a smaller value for the shiny app then we need for direct writing onto a graphic device. 
 
 Details This graphs produced by this single function cover most of the first semester introductory Statistics course. Value "trellis" object. Note This function is built on lattice and latticeExtra. It supersedes the similar function normal.and.t.dist built on base graphics that is used in many displays in the book by Erich Neuwirth and me: R through Excel, Springer (2009). http://www.springer.com/978-1-4419-0051-7. Many details, particularly the alternate color scheme and the concept of floating probability labels, grew out of discussions that Erich and I have had since the book was published. This version incorporates some ideas suggested by Moritz Heene. Aliases NormalAndTplot NormalAndT NormalAndTplot.default NormalAndTplot.htest Examples NormalAndTplot(mean0=0, mean1=2, xbar=1.8, xlim=c(-3, 5)) NormalAndTplot(mean0=0, mean1=2, xbar=1.8, xlim=c(-3, 5), distribution.name="t", df=4) NormalAndTplot(mean0=100, sd=12, mean1=113, xbar=105, xlim=c(92, 120), n=20) NormalAndTplot(mean0=100, sd=12, mean1=113, xbar=105, xlim=c(92, 120), n=20, z1axis=TRUE) NormalAndTplot(mean0=100, sd=12, xbar=105, xlim=c(92, 108), n=20, ntcolors="stoplight") NormalAndTplot(xbar=95, sd=10, xlim=c(65, 125), type="confidence", alpha.left=.025, alpha.right=.025) shiny::runApp(file.path(system.file(package="HH"), "shiny")) ## mean1 and xbar NormalAndTplot(mean0=0, mean1=2, xbar=1.8, xlim=c(-3, 5)) NormalAndTplot(mean0=0, mean1=-2, xbar=-1.8, xlim=c(-5, 3), alpha.left=.05, alpha.right=0) NormalAndTplot(mean0=0, mean1=2, xbar=2.1, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025) NormalAndTplot(mean0=0, mean1=-2, xbar=-2.1, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025) ## mean1 NormalAndTplot(mean0=0, mean1=2, xbar=NA, xlim=c(-3, 5)) NormalAndTplot(mean0=0, mean1=-2, xbar=NA, xlim=c(-5, 3), alpha.left=.05, alpha.right=0) NormalAndTplot(mean0=0, mean1=2, xbar=NA, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025) NormalAndTplot(mean0=0, mean1=-2, xbar=NA, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025) ## xbar NormalAndTplot(mean0=0, mean1=NA, xbar=1.8, xlim=c(-3, 5)) NormalAndTplot(mean0=0, mean1=NA, xbar=-1.8, xlim=c(-5, 3), alpha.left=.05, alpha.right=0) NormalAndTplot(mean0=0, mean1=NA, xbar=2.1, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025) NormalAndTplot(mean0=0, mean1=NA, xbar=-2.1, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025) ## t distribution ## mean1 and xbar NormalAndTplot(mean0=0, mean1=2, xbar=1.8, xlim=c(-3, 5), distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=-2, xbar=-1.8, xlim=c(-5, 3), alpha.left=.05, alpha.right=0, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=2, xbar=2.1, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=-2, xbar=-2.1, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) ## mean1 NormalAndTplot(mean0=0, mean1=2, xbar=NA, xlim=c(-3, 5), distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=-2, xbar=NA, xlim=c(-5, 3), alpha.left=.05, alpha.right=0, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=2, xbar=NA, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=-2, xbar=NA, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) ## xbar NormalAndTplot(mean0=0, mean1=NA, xbar=1.8, xlim=c(-3, 5), distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=NA, xbar=-1.8, xlim=c(-5, 3), alpha.left=.05, alpha.right=0, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=NA, xbar=2.1, xlim=c(-3, 5), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) NormalAndTplot(mean0=0, mean1=NA, xbar=-2.1, xlim=c(-5, 3), alpha.left=.025, alpha.right=.025, distribution.name="t", df=4) ## confidence intervals NormalAndTplot(mean0=0, xlim=c(-3, 4), type="confidence") NormalAndTplot(xbar=01, xlim=c(-3, 4), type="confidence") NormalAndTplot(mean0=0, xlim=c(-4, 3), type="confidence", alpha.left=.05, alpha.right=0) NormalAndTplot(mean0=0, xlim=c(-3, 3), type="confidence", alpha.left=.025, alpha.right=.025) NormalAndTplot(mean0=95, sd=10, xlim=c(65, 125), type="confidence", alpha.left=.025, alpha.right=.025) NormalAndTplot(mean0=95, sd=10, xlim=c(65, 125), type="confidence", alpha.left=.025, alpha.right=.025, distribution="t", df=10) Documentation reproduced from package HH, version 3.1-8, License: GPL (>= 2) Community examples Looks like there are no examples yet. Post a new example: 
 
 
 R package Rdocumentation.org Created by DataCamp.com 
 Put your R skills to the test MathJax.Hub.Config({ messageStyle: "none", jax: ["input/TeX","output/CommonHTML"], extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"], TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] }, tex2jax: { inlineMath: [ ['$','$'], ['\$','\$'] ], displayMath: [ ['$$','$$'] ], processEscapes: true, preview: 'none' } }); var $jq = jQuery.noConflict(); ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//cdn.datacamp.com/sp/2.9.3.js","snowplow")); var options = { appId: 'rdocumentation', platform: 'web', post: true, discoverRootDomain: true, contexts: { webPage: true, performanceTiming: true } }; options.forceSecureTracker = true; options.postPath = '/spevent'; window.snowplow('newTracker', 'co', "www.datacamp.com", options); window.snowplow('enableActivityTracking', 10, 10); // Ping every 10 seconds after 10 seconds window.snowplow('enableLinkClickTracking'); window.snowplow('trackPageView', null, [ { schema: 'iglu:com.datacamp/user/jsonschema/1-0-0', data: { anonId:$jq.cookie('dc_aid'), } } ]); var config = { forms: { whitelist: ["snowplow_tracked"] }, fields: { blacklist: ['password', 'password_confirmation'] } }; window.snowplow('enableFormTracking', config); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-41577880-1', 'rdocumentation.org'); ga('send', 'pageview');