modelSize {enmSdmX} | R Documentation |
Number of response data in a model object
Description
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.
Usage
modelSize(x, binary = TRUE, graceful = TRUE)
Arguments
x |
A model object. This can be of many classes, including "gbm", "glm", "gam", "MaxEnt", and so on. |
binary |
If |
graceful |
If |
Value
One or two named integers.
Examples
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)
[Package enmSdmX version 1.1.6 Index]