modelSize | R Documentation |
This function returns the number of response data used in a model (i.e., the sample size). If the data are binary it can return the number of 1s and 0s.
modelSize(x, binary = TRUE, graceful = TRUE)
x |
A model object. This can be of many classes, including "gbm", "glm", "gam", "MaxEnt", and so on. |
binary |
If |
graceful |
If |
One or two named integers.
set.seed(123)
y <- runif(1:101)^2
yBinary <- as.integer(y > 0.6)
x <- data.frame(x1=1:101, x2=rnorm(101))
model <- lm(y ~ x1 + x2, data=x)
modelBinary <- glm(yBinary ~ x1 + x2, data=x, family='binomial')
modelSize(model, FALSE)
modelSize(model, TRUE) # not binary input... notice warning
modelSize(modelBinary)
modelSize(modelBinary, FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.