gen_base_binomial_reg | R Documentation |
It generates N
observations of the Binomial distribution with parameters ni
(the i-th's individual sizes) and p
(the success probability), where the coefficients are indexed on p
via the logistic function.
gen_base_binomial_reg(N, beta, Covariates, ni = rep(1, N))
N |
The number of observations that will be generated. It must be a positive integer. |
beta |
A vector of coefficients including the intercept. It can be a matrix. |
Covariates |
A data.frame object with the predictors (without intercept) for which we want to test if they are relevant to the response variable. It can also be a ( |
ni |
A vector of size |
The function return a table with the sample of size N from the Binomial distribution indexed with the predictors indicated in the Covariates
argument, the ni
, the number of failures (ni
- y
), and the predictors for each individual .
N<-200 #Number of extractions
beta<-c(1, 0, 2, 0, 3, 2) #Coefficient vector
p<-length(beta)
aux_cov<-rnorm((p-1)*N, 0,1)
Covariates<-data.frame(matrix(aux_cov, ncol=p-1, nrow=N)) #Generating the Covariates data.frame
colnames(Covariates)<-c("X1", "X2", "X3", "X4", "X5")
base<-gen_base_binomial_reg(N, beta, Covariates, ni=rep(1, N)) #Generating the data
base
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.