getPlotSummary {iNZightPlots} | R Documentation

## iNZight Plot Summary and Inference

### Description

Generate summary or inference information for an iNZight plot

### Usage

    getPlotSummary(
      x,
      y = NULL,
      g1 = NULL,
      g1.level = NULL,
      g2 = NULL,
      g2.level = NULL,
      varnames = list(),
      colby = NULL,
      sizeby = NULL,
      data = NULL,
      design = NULL,
      freq = NULL,
      missing.info = TRUE,
      inzpars = inzpar(),
      summary.type = "summary",
      table.direction = c("horizontal", "vertical"),
      hypothesis.value = 0,
      hypothesis.alt = c("two.sided", "less", "greater"),
      hypothesis.var.equal = FALSE,
      hypothesis.use.exact = FALSE,
      hypothesis.test = c("default", "t.test", "anova", "chi2", "proportion"),
      hypothesis.simulated.p.value = FALSE,
      hypothesis = list(value = hypothesis.value, alternative = match.arg(hypothesis.alt),
        var.equal = hypothesis.var.equal, use.exact = hypothesis.use.exact, test =
        match.arg(hypothesis.test), simulated.p.value = hypothesis.simulated.p.value),
      survey.options = list(),
      width = 100,
      epi.out = FALSE,
      privacy_controls = NULL,
      ...,
      env = parent.frame()
    )

### Arguments

`x` | a vector (numeric or factor), or the name of a column in the supplied `data` or `design` object
`y` | a vector (numeric or factor), or the name of a column in the supplied `data` or `design` object
`g1` | a vector (numeric or factor), or the name of a column in the supplied `data` or `design` object. This variable acts as a subsetting variable.
`g1.level` | the name (or numeric position) of the level of `g1` that will be used instead of the entire data set
`g2` | a vector (numeric or factor), or the name of a column in the supplied `data` or `design` object. This variable acts as a subsetting variable, similar to `g1`
`g2.level` | same as `g1.level`, however takes the additional value `"_MULTI"`, which produces a matrix of `g1` by `g2`
`varnames` | a list of variable names, with the list named using the appropriate arguments (i.e., `list(x = "height", g1 = "gender")`)
`colby` | the name of a variable (numeric or factor) to colour points by. In the case of a numeric variable, a continuous colour scale is used, otherwise each level of the factor is assigned a colour
`sizeby` | the name of a (numeric) variable, which controls the size of points
`data` | the name of a data set
`design` | the name of a survey object, obtained from the `survey` package
`freq` | the name of a frequency variable if the data are frequencies
`missing.info` | logical, if `TRUE`, information regarding missingness is displayed in the plot
`inzpars` | allows specification of iNZight plotting parameters over multiple plots
`summary.type` | one of `"summary"` or `"inference"`
`table.direction` | one of 'horizontal' (default) or 'vertical' (useful for many categories)
`hypothesis.value` | H0 value for hypothesis test
`hypothesis.alt` | alternative hypothesis (!=, <, >)
`hypothesis.var.equal` | use equal variance assumption for t-test?
`hypothesis.use.exact` | logical, if `TRUE` the exact p-value will be calculated (if applicable)
`hypothesis.test` | in some cases (currently just two-samples) can perform multiple tests (t-test or ANOVA)
`hypothesis.simulated.p.value` | also calculate (where available) the simulated p-value
`hypothesis` | either NULL for no test, or missing (in which case above arguments are used)
`survey.options` | additional options passed to survey methods
`width` | width for the output, default is 100 characters
`epi.out` | logical, if `TRUE`, then odds/rate ratios and rate differences are printed when appropriate (`y` with 2 levels)
`privacy_controls` | optional, pass in confidentialisation and privacy controls (e.g., random rounding, suppression) for microdata
`...` | additional arguments, see `inzpar`
`env` | compatibility argument

### Details

Works much the same as `iNZightPlot`

### Value

an `inzight.plotsummary` object with a print method

### Author(s)

Tom Elliott

### Examples

    getPlotSummary(Species, data = iris)
    getPlotSummary(Species, data = iris,
        summary.type = "inference", inference.type = "conf")

    # perform hypothesis testing
    getPlotSummary(Sepal.Length, data = iris,
        summary.type = "inference", inference.type = "conf",
        hypothesis.value = 5)

    # if you prefer a formula interface
    inzsummary(Sepal.Length ~ Species, data = iris)
    inzinference(Sepal.Length ~ Species, data = iris)

    ## confidentialisation and privacy controls
    # random rounding and suppression:
    HairEyeColor_df <- as.data.frame(HairEyeColor)
    inzsummary(Hair ~ Eye, data = HairEyeColor_df, freq = Freq)
    inzsummary(Hair ~ Eye, data = HairEyeColor_df, freq = Freq,
        privacy_controls = list(
            rounding = "RR3",
            suppression = 10
        )
    )

[Package iNZightPlots version 2.14.1 Index]