Learn R Programming

heplots (version 1.6.2)

SocGrades: Grades in a Sociology Course

Description

The data set SocGrades contains four outcome measures on student performance in an introductory sociology course together with six potential predictors. These data were used by Marascuilo and Levin (1983) for an example of canonical correlation analysis, but are also suitable as examples of multivariate multiple regression, MANOVA, MANCOVA and step-down analysis in multivariate linear models.

Arguments

Format

A data frame with 40 observations on the following 10 variables.

class

Social class, an ordered factor with levels 1 > 2 > 3

sex

sex, a factor with levels F M

gpa

grade point average

boards

College Board test scores

hssoc

previous high school unit in sociology, a factor with 2 no, yes

pretest

score on course pretest

midterm1

score on first midterm exam

midterm2

score on second midterm exam

final

score on final exam

eval

course evaluation

Details

midterm1, midterm2, final, and possibly eval are the response variables. All other variables are potential predictors.

The factors class, sex, and hssoc can be used with as.numeric in correlational analyses.

Examples

Run this code

data(SocGrades)
# basic MLM
grades.mod <- lm(cbind(midterm1, midterm2, final, eval) ~ 
	class + sex + gpa + boards + hssoc + pretest, data=SocGrades)
	
car::Anova(grades.mod, test="Roy")

clr <- c("red", "blue", "darkgreen", "magenta", "brown", "black", "darkgray")
heplot(grades.mod, col=clr)
pairs(grades.mod, col=clr)

if (FALSE) {
heplot3d(grades.mod, col=clr, wire=FALSE)
}

if (require(candisc)) {
	# calculate canonical results for all terms
	grades.can <- candiscList(grades.mod)
	# extract canonical R^2s
	unlist(lapply(grades.can, function(x) x$canrsq))
	# plot class effect in canonical space
	heplot(grades.can, term="class", scale=4)	

	# 1 df terms: show canonical scores and weights for responses
	plot(grades.can, term="sex")
	plot(grades.can, term="gpa")
	plot(grades.can, term="boards")
	}


Run the code above in your browser using DataLab