Built with blockbuilder.org
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { width:100%; height: 100% }
</style>
</head>
<body>
<button id="button1">Click</button>
<script>
// Feel free to change or delete any of the code you see!
var svg = d3.select("body").append("svg")
.attr({x: 100, y: 10, width: 700, height: 480})
.append("g").classed("main", true)
svg.selectAll(".dots").data(d3.range(1, 52)).enter()
.append("circle").classed("dots", true)
.attr("cx", function (d, i) { return i*10})
.attr("cy", function (d, i) { return i*10})
.attr("r", 5)
function update() {
d3.selectAll(".dots")
.transition()
.duration(1000)
.attr("cx", function (d, i) { return i*5})
.attr("cy", function (d, i) { return i*5})
}
d3.select("#button1").on("click", update)
var Highest_actor_Ulmer_score = 200;
var Secnd_highest_actor_Ulmer_score = 100;
var Seats = 1500;
var Week = 30;
var Original = 1;
var Musical = 1;
var cast = 45;
var Disney = 0;
var basedMovie = 0;
var NYT = 1;
var USAToday = 4;
var Tony = 3;
var Comedy = 1;
var Drama = 1;
var Past_author = 1;
var R;
// predictor function call
predictor(Highest_actor_Ulmer_score, Secnd_highest_actor_Ulmer_score, Seats, Week, Original, Musical, cast, Disney, basedMovie, NYT, USAToday, Tony, Comedy, Drama, Past_author)
function predictor (Highest_actor_Ulmer_score, Secnd_highest_actor_Ulmer_score, Seats, Week, Original, Musical, cast, Disney, basedMovie, NYT, USAToday, Tony, Comedy, Drama, Past_author) {
R = Highest_actor_Ulmer_score + Secnd_highest_actor_Ulmer_score + Seats + Week + Original + Musical + cast + Disney + basedMovie + NYT + USAToday + Tony + Comedy + Drama;
var ProbSellout = 1/(1+(Math.exp(-(-(0.0042183*Highest_actor_Ulmer_score)+(0.0039907*Secnd_highest_actor_Ulmer_score)+(0.0000626*(Highest_actor_Ulmer_score^2))+(0.00000812*(Secnd_highest_actor_Ulmer_score^2))-(0.0007982*Seats)+(0.0419669*((Week===47?1:0)))+(1.041139*(((Week==52?(6/7):(Week==53?3/7:0)))^2))-(0.1213413*Week)+(0.0129541*(Week^2))-(0.0003998*(Week^3))+(0.00000373*(Week^4))-(0.4756087*Original)-(3.885171*Musical)-(0.092289*cast*Musical)+(1.883142*Disney)-(0.0162975*basedMovie)+(0.0839098*cast)+(0.1854669*NYT)-(0.8336684*(1-NYT))+(0.2028874*Musical*USAToday)+(0.1258541*NYT*Musical)+(0.3561441*Musical*(1-NYT))-(0.470837*(Math.log(cast)))+(1.802581*Musical*(Math.log(cast)))+(1.217256*(Math.log(Tony)))-(0.5184693*Musical*(Math.log(Tony+1)))-(0.1466195*Comedy)-(0.157074*Drama)+(0.0150286*(Math.log(Past_author+1)))-1.9122703))))
console.log(ProbSellout)
return ProbSellout;
}
console.log(d3.range(1, 52));
</script>
</body>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js