Description Usage Arguments Value References Examples
This function uses the function mi.t.test in R package MKmisc to perform one or two sample Student's t-test on an incomplete dataset using multiple imputation and determines the sufficient number of imputed datasets using iterative multiple imputation (imi) procedure.
1 2 3 | imi.t.test(data.miss,M0=2,max.M=500,epsilon,method='pmm',
x, y = NULL, alternative='two.sided',mu,paired = FALSE,
var.equal = FALSE, conf.level = 0.95,conv.plot=TRUE,successive.valid=3)
|
data.miss |
A data frame with the variable in the model as its columns. Note that the missing values should be indicated by NA. |
M0 |
The initial number of imputations, it should be an integer with minimum 2. It also can take the string value 'auto' which lets the user to decide about the initial number of imputation after the software reports the time it takes to impute the data and fit the model to it twice. |
max.M |
The maximum number of iterations which the algorithm should terminate afterwards in case of non-covergence. |
epsilon |
The threshold for difference between two iterations. |
method |
Specifying string value 'mvn' would impute the data using a multivariate normal predictive model in R package amelia2, any other specification will impute the data using fully conditional specification approach in R package mice. One can see the method in documentation of function mice in R package mice. Specifying 'auto' will selected the predictive model based on the measurement level of each variable. |
x |
Name of the data column which the t-test should be performed on it. |
y |
In case of two sample t-test this input variable specifiess the name of the second column for paired-test, or an indicator variable showing different populations for indepdendent two sample t-test. |
alternative |
A character string specifying the alternative hypothesis, it takes the values "two.sided" (default), "greater" or "less". |
mu |
A real number specifying the test value. |
paired |
A logical value specifying whether a paired t-test should be performed or not. |
var.equal |
A logical value specifying whether variance equality should be assumed or not. |
conf.level |
Confidence level of the test. |
conv.plot |
A logitical value, if TRUE then a convergence plot will be generated, if FALSE no plot will be provided. |
successive.valid |
An integer with minimum 1 which specifies the number of successive steps the stopping rule should be validated so the procedure could terminate. |
print.progress |
A logical variable, if TRUE it prints the progress of imputation. |
test.result |
A list with the final MI-based outcome of the t-test. |
data.imp |
A list with imputed datasets as its components. |
dis.steps |
A vector with computed distance between iterations. |
conv.status |
If 1 then convergence is achieved, if 0 with max.M iterations, still the convergence could not be achieved. |
M |
The selected number of imputed datasets. |
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/t.test.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # To illustrate the use of this function we use the cholestrol dataset in R package norm2.
> library(norm2)
> data(cholesterol)
>
> chol.ttest=imi.t.test (cholesterol,M0='manual',max.M=500,epsilon=0.05/10,method='mvn',
+ x=names(cholesterol)[3], y = NULL, alternative='two.sided',mu=220,
+ paired = FALSE, var.equal = FALSE,
+ conf.level = 0.95,conv.plot=TRUE,successive.valid='manual')
-- Imputation 1 --
1 2 3 4 5 6
[1] "The time it takes (in seconds) to imput the data once and fit the model to it is: 0.01"
What is your choice of initial number of imputations?2
What is your choice for successive steps validation?3
-- Imputation 1 --
1 2 3 4 5 6 7 8
-- Imputation 1 --
1 2 3 4 5 6 7
# it continues till the convergence happens.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.