Published
Edited
Dec 14, 2019
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
totalCollaborationSubsidy = total_subsidiesCollaborative - total_subsidiesNonCollaborative
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
printTable(tableTPositive)
Insert cell
printTable(tableTNegative)
Insert cell
Insert cell
Insert cell
// Uncomment to see the above plot with linear scales, as opposed to symlog scales
// unalteredScales.render()
Insert cell
Insert cell
// Uncomment to see the above plot with linear scales, as opposed to symlog scales
// unalteredScalesSubsidy.render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
collaboration_multiplier = (final_agg_score) => (final_agg_score+20)/10
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Creates a dict indexed by question ids, which houses the balances at the end of all questions for all users
create_balances_object = async (collaborative) => {
let balances = ({})
const ms = await measurableIds
for (const measurable of ms) {
let id = Object.keys(measurable)[0]
balances[id] = ({})
let title = measurable[id]["Title"]
balances[id]["Title"] = title
let balance = await get_question_balance(id, collaborative)
balances[id]["Balance"] = balance
}
return balances
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function getDataSet(isCollaborative, positiveScores){
let score = isCollaborative ? "scoreCollaborative": "scoreNonCollaborative"
let filteredT = positiveScores ? tableTPositive : tableTNegative
let min = Math.min(filteredT.map(element => element[score]))
min = min<0 ? -min: 0
let result = []
filteredT.forEach(element => {
result.push(
{
name: element.name,
score: positiveScores ? element[score] : - element[score] // previously +min
}
)
})
return result

}
Insert cell
// getDataSet(true, true)
Insert cell
// getDataSet(true, false)
Insert cell
// getDataSet(false, true)
Insert cell
// getDataSet(false, false)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
math = require('https://cdnjs.cloudflare.com/ajax/libs/mathjs/6.2.2/math.js')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more