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.
(Question 1)# Which department has the lowest enrollment? by John Raesly
var grps = _.groupBy(data, 'CrsPBADept')
var ret1 = _.mapValues(grps, function(d){
var enrollNumbers = _.pluck(d, 'N.ENROLL')
return _.sum(enrollNumbers)
})
var min = _.min(ret1)
var dept = _.pick(ret1, function(d){
return d == min
})
return dept
How many instructors have taught each subject?
by (KariSantos)
var groups =_.groupBy(data,function(d){return d.Subject})
var result =_.mapValues(groups,function(t){
var pluckinst=_.pluck(t,'Instructors')
return _.size(_.uniq(_.flatten( _.map(pluckinst,function(t){return _.pluck(t,'name')}))))
})
return result
{
"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
}
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 |
(Question 3) Which course has the highest enrollment?by andrew
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
First-Year Writing and Rhetoric |
3187 |
(Question 4)Which subject is most in demand,based on the total number of enrollment?by Sushant Mittal
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
(Question 5) Does the instruction tends to give out higher grades if they teach more classes? or the reverse?
//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 = _.reduce(d, function(total,e){
return total+e.AVG_GRD;
},0)/_.size(d);
var obj = {classcount:_.first(d).classcount,AVG_GRD:avg,instrCount:_.size(d)}
return obj;
});
return avgbyCount
{
"1": {
"classcount": 1,
"AVG_GRD": 3.282425000000004,
"instrCount": 800
},
"2": {
"classcount": 2,
"AVG_GRD": 3.2711051829268296,
"instrCount": 656
},
"3": {
"classcount": 3,
"AVG_GRD": 3.30401925391095,
"instrCount": 277
},
"4": {
"classcount": 4,
"AVG_GRD": 3.213417266187052,
"instrCount": 139
},
"5": {
"classcount": 5,
"AVG_GRD": 3.2277377049180327,
"instrCount": 61
},
"6": {
"classcount": 6,
"AVG_GRD": 3.1722222222222216,
"instrCount": 69
},
"7": {
"classcount": 7,
"AVG_GRD": 3.202216748768473,
"instrCount": 29
},
"8": {
"classcount": 8,
"AVG_GRD": 3.10605,
"instrCount": 25
},
"9": {
"classcount": 9,
"AVG_GRD": 3.5538095238095244,
"instrCount": 7
},
"10": {
"classcount": 10,
"AVG_GRD": 2.717,
"instrCount": 2
},
"14": {
"classcount": 14,
"AVG_GRD": 3.4803571428571427,
"instrCount": 2
},
"15": {
"classcount": 15,
"AVG_GRD": 3.5316666666666663,
"instrCount": 2
},
"16": {
"classcount": 16,
"AVG_GRD": 3.861875,
"instrCount": 1
},
"20": {
"classcount": 20,
"AVG_GRD": 3.304500000000001,
"instrCount": 1
},
"21": {
"classcount": 21,
"AVG_GRD": 2.5514285714285716,
"instrCount": 1
},
"22": {
"classcount": 22,
"AVG_GRD": 3.185000000000001,
"instrCount": 1
},
"25": {
"classcount": 25,
"AVG_GRD": 2.9128,
"instrCount": 1
},
"26": {
"classcount": 26,
"AVG_GRD": 3.1234615384615387,
"instrCount": 1
},
"27": {
"classcount": 27,
"AVG_GRD": 2.906296296296296,
"instrCount": 1
},
"33": {
"classcount": 33,
"AVG_GRD": 2.695757575757576,
"instrCount": 1
},
"39": {
"classcount": 39,
"AVG_GRD": 2.733589743589744,
"instrCount": 1
},
"41": {
"classcount": 41,
"AVG_GRD": 2.599024390243903,
"instrCount": 1
},
"60": {
"classcount": 60,
"AVG_GRD": 2.917166666666667,
"instrCount": 1
},
"64": {
"classcount": 64,
"AVG_GRD": 2.375000000000001,
"instrCount": 1
}
}