wrapChiSqTest.data.frame: Format ChiSqTest from data.

View source: R/ChiSqTest.R

wrapChiSqTest.data.frameR Documentation

Format ChiSqTest from data.

Description

Format ChiSqTest from data.

Usage

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

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

Value

wrapped test

Examples


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)


sigr documentation built on Aug. 20, 2023, 9:06 a.m.