Description Usage Arguments Details Value Author(s) References Examples
wle.t.test
performs one and two sample Weighted Likelihood t-tests on vectors of data. This is a robust version of the classical t-test. It should be used when the majority of the data follows a normal distribution.
1 2 3 4 |
x |
a numeric vector of data values. |
y |
an optional numeric vector data values. |
alternative |
character specifying the alternative hypothesis,
must be one of |
mu |
a number indicating the true value of the mean (or difference in means if you are performing a two sample test). |
paired |
a logical indicating whether you want a paired weighted t-test. |
var.equal |
a logical variable indicating whether to treat the
two variances as being equal. If |
conf.level |
confidence level of the interval. |
boot |
the number of starting points based on boostrap subsamples to use in the search of the roots. |
group |
the dimension of the bootstap subsamples. The default value is max(round(size/4),2) where size is the number of observations. |
num.sol |
maximum number of roots to be searched. |
raf |
type of Residual adjustment function to be use:
|
smooth |
the value of the smoothing parameter. |
tol |
the absolute accuracy to be used to achieve convergence of the algorithm. |
equal |
the absolute value for which two roots are considered the same. (This parameter must be greater than |
max.iter |
maximum number of iterations. |
If paired
is TRUE
then both x
and y
must
be specified and they must be the same length. Missing values are
removed (in pairs if paired
is TRUE
). If
var.equal
is TRUE
then the pooled estimate of the
variance is used. By default, if var.equal
is FALSE
then the variance is estimated separately for both groups and the
Welch modification to the degrees of freedom is used.
The function return a list of class "wle.t.test"
with the following components:
test |
A list with two dimensions. Each cell is related with a combination of 'x', 'y' roots. In each cell a list of class
|
x.tot.sol |
the number of solutions for the dataset 'x'. |
y.tot.sol |
the number of solutions for the dataset 'y' or 1. |
call |
the match.call(). |
paired |
a logical indicating whether is a paired weighted t-test. |
x |
'x' data. |
y |
'y' data or |
Claudio Agostinelli
Agostinelli, C., (1998) Inferenza statistica robusta basata sulla funzione di verosimiglianza pesata: alcuni sviluppi, Ph.D Thesis, Department of Statistics, University of Padova (in italian).
Agostinelli, C., (2002) Un approccio alla verifica d'ipotesi robusta basato sulla funzione di verosimiglianza pesata - Robust Testing Hypotheses via Weighted Likelihood function, Statistica, Anno LXII, 1, 87-110.
Agostinelli, C., and Markatou, M., (2001) Test of hypotheses based on the Weighted Likelihood Methodology, Statistica Sinica, vol. 11, n. 2, 499-514.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | library(wle)
set.seed(1234)
x <- rnorm(20,0,1)
y <- rnorm(20,6,1)
t.test(x,y) # P < 2.2e-16
wle.t.test(x,y,group=5) # P < 2.2e-16
t.test(x,y=c(y,250)) # P = 0.1419 -- NOT significant anymore
wle.t.test(x,y=c(y,250),group=5) # P < 2.2e-16 -- still significant
set.seed(1234)
# three roots for 'x' and three roots for 'y'
# with nine t-test value
res <- wle.t.test(x=c(rnorm(40,0,1),rnorm(40,10,1)),
y=c(rnorm(40,0,1),rnorm(40,10,1)),
group=4,num.sol=3,boot=100)
print(res) # print ALL the t-test
print(res,x.root=1,y.root=1) # print the test associated to the
# x.root=1,y.root=1
root.1.1 <- res$test[[1]][[1]] # access to the object associated
# to the x.root=1,y.root=1
names(root.1.1)
set.seed(1234)
# one root and NOT significant t-test
wle.t.test(x=c(rnorm(40,0,1),rnorm(40,10,1)),
y=c(rnorm(40,0,1),rnorm(40,10,1)),
group=4,num.sol=3,boot=100,paired=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.