scor.test {Kmisc}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

scor.test(dados, scor = 1:ncol(dados))

Arguments

dados ~~Describe dados here~~
scor ~~Describe scor here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(dados, scor=1:ncol(dados)) {
  if (is.null(colnames(dados)))
    colnames(dados) <- scor
  names(scor) <- colnames(dados)
  dados <- exclui.na(dados)
  scor <- scor[is.element(names(scor), colnames(dados))]
  if (is.null(dim(dados)))
    return(NA)
  dados[is.na(dados)] <- 0
  I <- 1:nrow(dados)
  J <- 1:ncol(dados)
  n.j <- apply(dados, 2, sum)
  ni. <- apply(dados, 1, sum)
  n <- sum(dados)
  f <- sapply(I, function(i, a, dad, si) sum(a*dad[i,]/si[i]),
              scor, dados, ni.)
  names(f) <- rownames(dados)
  mu <- sum(sapply(J, function(j, a, sj, n) a[j]*sj[j]/n,
                   scor, n.j, n))
  v <- sum(((scor - mu)^2)*n.j/n)
  Qs <- (n-1)*sum(ni.*((f-mu)^2))/(n*v)
  df <- nrow(dados)-1
  pval <- pchisq(Qs, df, lower.tail=FALSE)
  res <- list(statistic=Qs, df=df, p.value=pval, estimate=f, mu=mu, var=v)
  class(res) <- "scor.test"
  return(res)
  }

[Package Kmisc version 1.0 Index]