book

Report

As a class, we brainstormed and came up with a long list of further questions we can ask based on the FCQ data. Out of these questions, our team chose to tackle on the following questions. Each member on our team is reponsible for one question.

Which course has the highest enrollment? by Andrew Berumen

var groups = _.groupBy(data, 'CourseTitle');
var coursesEnroll = _.mapValues(groups, function(d){
    var enrollNumbers = _.pluck(d, 'N.ENROLL')
    return _.sum(enrollNumbers)
})
var max = _.max(coursesEnroll);
var bigClass =  _.pick(coursesEnroll, function(d){
    return d == max;
});


return bigClass;

Class Title Enrollment
First-Year Writing and Rhetoric 3187

Which department has the lowest enrollment? by John

var groups = _.groupBy(data, 'CrsPBADept');
var coursesEnroll = _.mapValues(groups, function(d){
    var enrollNumbers = _.pluck(d, 'N.ENROLL')
    return _.sum(enrollNumbers)
})
var min = _.min(coursesEnroll);
var smallDept =  _.pick(coursesEnroll, function(d){
    return d == min;
});
return smallDept;

Department Enrollment
RASE 30

How many instructors have taught each subject? by Kari

var groups = _.groupBy(data, 'Subject');
// collect all the instructor names for each class and count uniq
var ret1 = _.mapValues(groups, function(d){
 	var instrArr = _.pluck(d, 'Instructors');
 	//var j = 0;
 	var nameArr = _.map(instrArr, function(d){
 		var names = _.pluck(d, 'name');
 		//if (j==0){console.log(names); j++}
 		return names;
 	});
 	return _.size(_.uniq(_.flatten(nameArr)));
});

return ret1;

Subject Num Instructors
HIST 45
HONR 10
HUMN 13
IAFS 16
IPHY 34
LING 19
MATH 61
MCDB 32
BAKR 3
PHIL 48
PHYS 54
PSCI 47
NRSC 9
PSYC 47
WRTG 85
RLST 13
SLHS 28
SOCY 58
ARAB 3
PORT 2
SPAN 62
COMR 4
FARR 8
GSAP 2
INVS 5
PACS 2
SEWL 3
DNCE 31
THTR 31
WMST 14
ACCT 17
BADM 16
BCOR 23
BSLW 1
BUSM 5
CESR 5
ESBM 13
FNCE 16
INBU 3
MBAC 11
MBAX 26
MGMT 28
MKTG 20
REAL 3
EDUC 75
ASEN 38
CHEN 21
CSCI 34
AREN 18
CVEN 40
ECEN 37
EMEN 9
EHON 2
GEEN 44
EVEN 2
HUEN 11
MCEN 48
TLEN 19
ATLS 18
MUSM 5
RSEI 1
JOUR 52
LAWS 89
CONV 2
EMUS 19
MUEL 25
MUSC 50
PMUS 31
TMUS 1
AIRR 5
MILR 5
NAVR 6
CSVC 2
LDSP 9
NRLN 1
PRLC 3
ARCH 1
ENVD 35
ARTH 10
ARTS 40
CAMW 2
CWCV 1
LGBT 1
LIBB 3
CHIN 6
FRSI 1
HIND 1
JPNS 7
KREN 1
ANTH 23
APPM 28
ASTR 21
ARSC 20
ATOC 19
CHEM 34
CLAS 16
COMM 35
EBIO 35
ECON 48
ENGL 72
ENVS 16
ETHN 16
FILM 23
FREN 23
ITAL 9
GEOG 22
GEOL 30
GRMN 20
HEBR 3
RUSS 10
SCAN 2
SWED 1
LEAD 1

Does the instruction tends to give out higher grades if they teach more classes? or the reverse? by Ming

//var i = 0;  // for console.log
//var j = 0;  // for console.log
  // first I need to remove all entries that don't have an AVG_GRD (I have seen a couple!)
var graded = _.filter(data,function(d){
	return d.hasOwnProperty("AVG_GRD");
})
//console.log(_.size(graded))
var smallData = _.map(graded, function(d){
	// only want avg grade grade and instructor name
	// but there can be multiple instructors - return array of obj (grade,instructor)
	var avg_grd = d.AVG_GRD;
	//if (i==0){console.log(d.Instructors); i++}
	var nameArr = _.pluck(d.Instructors, 'name');
   //if (j==0){console.log(nameArr); j++}
 	// now take that array of names and map to an array of obj, each with a name and an avg grade
 	// this brought #entries from 5000 -> 4854
 	var objArray = _.map(nameArr, function(d){
 		var obj = {name:d,AVG_GRD:avg_grd};
 		return obj;
 	})
 	return objArray;
});

// smallData has array of arrays of obj, so flatten, then group by name
var groups = _.groupBy(_.flatten(smallData),'name');
//console.log(_.size(groups));
// groups are by name, with an array of obj containing name and avg grade
// we want convert each to an obj with class count and avg of avg, we don't even need name any more...
var groups2 = _.map(groups, function(d){
	var avg = _.reduce(d, function(total,e){
		return total+e.AVG_GRD;
	},0)/_.size(d);
	var obj = {classcount:_.size(d),AVG_GRD:avg,name:_.first(d).name}
	return obj;
});

var groups3 = _.groupBy(groups2,'classcount');
// each group has all of the instructors/grades that taught key # of classes.
// to finish, average all the grades together for each key, then done!
var avgbyCount = _.mapValues(groups3, function(d){
	var avg = _.round(_.reduce(d, function(total,e){
		return total+e.AVG_GRD;
	},0)/_.size(d),2);
	var obj = {classcount:_.first(d).classcount,AVG_GRD:avg,instrCount:_.size(d)}
	return obj;
});


return avgbyCount
Based on the table below, there does not seem to be a trend between the number of classes taught and average grade.

Num Classes Taught Avg GradeNum Instructors
1 3.28 800
2 3.27 656
3 3.3 277
4 3.21 139
5 3.23 61
6 3.17 69
7 3.2 29
8 3.11 25
9 3.55 7
10 2.72 2
14 3.48 2
15 3.53 2
16 3.86 1
20 3.3 1
21 2.55 1
22 3.19 1
25 2.91 1
26 3.12 1
27 2.91 1
33 2.7 1
39 2.73 1
41 2.6 1
60 2.92 1
64 2.38 1

Which subject is most in demand,based on the total number of enrollment? by Sussant

var group = _.groupBy(data, "Subject")
var sum = _.mapValues(group, function(n){
    var enroll = _.pluck(n, "N.ENROLL")
    return _.sum(enroll)
})
var max = _.max(sum)
var result = _.pick(sum, function(x){
    return x == max
})
return result

{
 "MATH": 8725
}

MATH is the subject most in demand with 8725 enrollments.