Skip to content

@mmparker /gist:969492
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Pared-down test interpretation function
qft.interp <- function(nil, tb, mitogen, tbnil.cutoff = 0.35){
# Set a tolerance to avoid floating point comparison troubles.
tol <- .Machine$double.eps ^ 0.5
# Set up the results vector
result <- rep(NA, times = length(nil))
# Iterate through each test.
for(i in seq_along(result)){
# If any test value is NA, no interpretation - skip
if(is.na(tb[i]) | is.na(nil[i]) | is.na(mitogen[i])) {next}
if(nil[i] + tol > 8.0) {result[i] <- "Indeterminate"} else {
if(tb[i] - nil[i] + tol > tbnil.cutoff & tb[i] - nil[i] + tol > .25 * nil[i])
{result[i] <- "Positive"} else {
if((tb[i] - nil[i] + tol < tbnil.cutoff | tb[i] - nil[i] + tol < .25 * nil[i]) &
!(mitogen[i] - nil[i] + tol < 0.5))
{result[i] <- "Negative"} else {
if((tb[i] - nil[i] + tol < tbnil.cutoff | tb[i] - nil[i] + tol < .25 * nil[i]) &
mitogen[i] - nil[i] + tol < 0.5)
{result[i] <- "Indeterminate"}
}
}
}
}
return(result)
}
@mmparker
Owner

Primitive version of a function that's now available in the R package tbdiag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.