% of upvotes as function of question length (logarithmic binning)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

DECLARE @LogBase FLOAT; SET @LogBase = ##LogBase:float?10##;

SELECT ROUND(LOG(LEN(p.Body), @LogBase), 1) AS 'Log(length)',
  100.0 * SUM(CASE v.VoteTypeId WHEN 2 THEN 1 ELSE 0 END) / COUNT(*) AS 'Upvote %'
  FROM Votes AS v
  INNER JOIN Posts AS p
    ON v.PostId = p.Id
  WHERE p.PostTypeId = 1 -- questions
    AND v.VoteTypeId IN (2, 3) -- up/downvotes
  GROUP BY ROUND(LOG(LEN(p.Body), @LogBase), 1)
  ORDER BY ROUND(LOG(LEN(p.Body), @LogBase), 1)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results