Description Usage Arguments Details Value Author(s) Examples
Estimates the p-value of a data set z for a test statistic Zobs with the Box-Cox function.
1 | PBC_Z(z,Ntot,N,param,Zobs,draw)
|
z |
Data set resulting from the initial one- sorted list of real numbers |
Ntot |
Number of observations in the initial data set - integer |
N |
Number of observations in the data set z - integer |
param |
Box-cox parameter lambda - real number: if param is missing, the parameter will be estimated with least squares; if it is a real number, this value will be used for lambda without performing any estimation |
Zobs |
Test statistic of the data set - real number |
draw |
If the linear regression of the Box-Plot method should be plotted or not - Boolean. |
The method is to compute the coefficients of the linear regression between log(-log(p)) and BoxCox(log(z)) where p is a list of probabilities correspondings to the sorted list of test statistics z.
Returns a list composed of:
p |
The value of the estimated p-value - real number |
interc |
The intercept of the linear regression used to estimate the p-value - real number |
pente |
The slope of the linear regression used to estimate the p-value - real number |
lbda |
The estimated parameter lambda (or the lambda given if not estimated) - real number |
Marion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | PBC_Z(z = tail(sort(rnorm(1e6)),500),Ntot = 1e6,N = 500,Zobs = 3)
## The function is currently defined as
function(z,Ntot,N,param,Zobs,draw){
p<-seq(N,1)/Ntot
if (missing(param))
lambda <- BoxCox_lm(log(-log(p)),log(z))
else
lambda <- param
coeffs <- lm( log(-log(p)) ~ BoxCox(log(z),lambda) )$coefficients
if (draw == TRUE)
plot(coeffs[[1]] + BoxCox(log(z),lambda) * coeffs[[2]],log(-log(p)),col="red",main="Linear regression of the Box-Plot method")
return(list(p = exp(-exp(sum( coeffs*c(1, BoxCox(log(Zobs),lambda))))),
interc = coeffs[[1]],
pente = coeffs[[2]],
lbda = lambda))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.