Description Usage Arguments Examples
This function will fit a linear model to two variables. The criterion can be continuous or binary. For logistic regression, set family = 'binomial'. For poisson regression, set family = 'poisson'. If omitted, family will default to 'gaussian' for standard linear regression.
1 |
data |
A data frame. |
x |
An independent variable |
y |
A dependent variable |
family |
A distribution ('gaussian', 'binomial', or 'poisson') |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Linear regression
biVarPlot(data = cars, x = dist, y = speed)
biVarPlot(data = mtcars, x = cyl, y = mpg)
biVarPlot(data = Orange, x = age, y = circumference)
biVarPlot(data = ChickWeight, x = Time, y = weight)
biVarPlot(data = USArrests, x = UrbanPop, y = Rape)
# Logistic regression
vot <- rnorm(20, 15, 5)
vot <- sort(vot)
phon <- c(0,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1)
df1 <- data.frame(vot, phon)
biVarPlot(data = df1, x = vot, y = phon, family = 'binomial')
# Poisson regression
time <- 1:10
counts <- c(18, 17, 21, 20, 25, 27, 30, 43, 52, 50)
df2 <- data.frame(time, counts)
biVarPlot(data = df2, x = time, y = counts, family = 'poisson')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.