SAVL and power laws

1

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS

Q&A for administrators, end users, developers and designers for Craft CMS

select top 10000 log(rank() over (order by Score desc)) as Rank
  , log(R.Score)
  --, log(R.Exponent)
from (
  select A.Id, A.Score
    , (cast(1 as float(53))/##a?80##)*(A.Score)*(1 + ##b?49##*cast(A.Score as float(53))/Q.ViewCount) as Exponent
  from Posts A
  inner join (
    select P.Id, max(P.ViewCount) as ViewCount
    from Posts P
    inner join PostTags PT on PT.PostId = P.Id
    inner join Tags T on T.Id = PT.TagId
    where ('##TagName?^_^##' = '^_^' or T.TagName = '##TagName?^_^##')
      and P.CreationDate >= dateadd(year, -(1+##MaxYearsElapsed?100##), getdate())
    group by P.Id
    ) Q on Q.Id = A.ParentId
  where (##UserId?-1## = -1 or A.OwnerUserId = ##UserId?-1##)
    --and A.CommunityOwnedDate is null
  ) R
  where R.Exponent > 0
    and log(R.Exponent) > -2

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results