Learn R Programming

sigr (version 1.1.5)

wrapChiSqTest.data.frame: Format ChiSqTest from data.

Description

Format ChiSqTest from data.

Usage

# S3 method for data.frame
wrapChiSqTest(
  x,
  predictionColumnName,
  yColumnName,
  ...,
  yTarget = TRUE,
  nParameters = 1,
  meany = mean(x[[yColumnName]] == yTarget),
  na.rm = FALSE
)

Value

wrapped test

Arguments

x

data frame containing columns to compare

predictionColumnName

character name of prediction column

yColumnName

character name of column containing dependent variable

...

extra arguments (not used)

yTarget

y value to consider positive

nParameters

number of variables in model

meany

(optional) mean of y

na.rm

logical, if TRUE remove NA values

Examples

Run this code

d <- data.frame(x=c(1,2,3,4,5,6,7,7),
      y=c(TRUE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE,FALSE))
model <- glm(y~x, data=d, family=binomial)
summary(model)
d$pred <- predict(model,type='response',newdata=d)
render(wrapChiSqTest(d,'pred','y'),pLargeCutoff=1)

Run the code above in your browser using DataLab