## create the dataset for variables and outcome
x=matrix(runif(100,-2,2),ncol=5)
outcome=0.5*x[,2] - 0.8*x[,4] + 0.3*x[,5]
data1=data.frame(outcome,x)
## fit a linear model
themodel(outcome~.,data1,usebinary=0)
## create binary outcome
outcome=outcome>runif(100,-2,2)
outcome[outcome]=1
data2=data.frame(outcome,x)
## fit a logistic regression model
themodel(outcome~.,data2,usebinary=1)
Run the code above in your browser using DataLab