Learn R Programming

singcar (version 0.1.5)

TD: Test of Deficit

Description

Crawford and Howell's (1998) modified t-test. Takes a single observation and compares it to a distribution estimated by a control sample. Calculates standardised difference between the case score and the mean of the controls and proportions falling above or below the case score, as well as associated confidence intervals.

Usage

TD(
  case,
  controls,
  sd = NULL,
  sample_size = NULL,
  alternative = c("less", "greater", "two.sided"),
  conf_int = TRUE,
  conf_level = 0.95,
  conf_int_spec = 0.01,
  na.rm = FALSE
)

Value

A list of class "htest" containing the following components:

statisticthe value of the t-statistic.parameter
the degrees of freedom for the t-statistic.p.valuethe p-value for the test.
estimateestimated standardised difference (Z-CC) and point estimate of p-value.
null.valuethe value of the difference under the null hypothesis.interval
named numerical vector containing level of confidence and confidence intervals for both Z-CC and p-value.descnamed numerical containing descriptive statistics: mean and standard deviations of controls as well as sample size and standard error used in the t-formula.
alternativea character string describing the alternative hypothesis.
methoda character string indicating what type of t-test was performed.data.name

Arguments

case

Case observation, can only be a single value.

controls

Numeric vector of observations from the control sample. If single value, treated as mean.

sd

If input of controls is single value, the standard deviation of the sample must be given as well.

sample_size

If input of controls is single value, the size of the sample must be gven as well.

alternative

A character string specifying the alternative hypothesis, must be one of "less" (default), "greater" or "two.sided". You can specify just the initial letter.

conf_int

Initiates a search algorithm for finding confidence intervals. Defaults to TRUE, set to FALSE for faster calculation (e.g. for simulations).

conf_level

Level of confidence for intervals, defaults to 95%.

conf_int_spec

The size of iterative steps for calculating confidence intervals. Smaller values gives more precise intervals but takes longer to calculate. Defaults to a specificity of 0.01.

na.rm

Remove NAs from controls.

Note of caution

Calculating the confidence intervals relies on finding non-centrality parameters for non-central t-distributions. Depending on the degrees of freedom, the confidence level and the effect size exact accuracy from the stats::qt() function used can not be guaranteed. However, the approximations should be good enough for most cases. See https://stat.ethz.ch/pipermail/r-help/2008-June/164843.html.

Details

Returns the point estimate of the standardised difference between the case score and the mean of the controls and the point estimate of the p-value (i.e. the percentage of the population that would be expected to obtain a lower or higher score, depending on the alternative hypothesis).

References

Crawford, J. R., & Howell, D. C. (1998). Comparing an Individual's Test Score Against Norms Derived from Small Samples. The Clinical Neuropsychologist, 12(4), 482 - 486. tools:::Rd_expr_doi("10.1076/clin.12.4.482.7241")

Crawford, J. R., & Garthwaite, P. H. (2002). Investigation of the single case in neuropsychology: Confidence limits on the abnormality of test scores and test score differences. Neuropsychologia, 40(8), 1196-1208. tools:::Rd_expr_doi("10.1016/S0028-3932(01)00224-X")

Examples

Run this code
TD(case = -2, controls = 0, sd = 1, sample_size = 20)

TD(case = size_weight_illusion[1, "V_SWI"],
   controls = size_weight_illusion[-1, "V_SWI"], alternative = "l")

Run the code above in your browser using DataLab