# Generate random data, place in data frame d
n <- 200
X1 <- rnorm(n)
X2 <- rnorm(n)
Y <- .7*X1 + .2*X2 + .6*rnorm(n)
Ybin <- cut(Y, breaks=2, labels=FALSE)
# instead, if read data with the Read function
# then the result is the data frame called d
d <- round(data.frame(X1, X2, Y, Ybin),2)
rm(Y); rm(Ybin); rm(X1); rm(X2)
# One-predictor regression
# Provide all default analyses including scatterplot etc.
Model(Y ~ X1)
# alternate form
model(Y ~ X1)
# Multiple regression model
# Provide all default analyses
Model(Y ~ X1 + X2)
# Logit analysis from a numeric response variable of 0's and 1's
d <- recode(Ybin, old=c(1,2), new=c(0,1), quiet=TRUE)
Model(Ybin ~ X1)
# t-test
Model(breaks ~ wool, data=warpbreaks)
# ANOVA analysis
# from a data frame other than the default d
# breaks is numerical, wool and tension are categorical
Model(breaks ~ wool + tension, data=warpbreaks)
# Analysis of covariance: one numerical and one categorical predictor
d <- Read("Employee", quiet=TRUE)
Model(Salary ~ Years + Gender)
# Logit analysis from a two-category response variable
Model(Gender ~ Salary)
Run the code above in your browser using DataLab