rank

rank deficiency warning mixed model lmer

允我心安 提交于 2019-12-03 17:20:13
I have a dataset with 142 data entries: 121 individuals measured on two occasions (two years, before and after treatment, Year = 0 or 1), in the second year 46 individuals were in treated plots and the rest were in control plots (treatment = 0 or 1). Here's some example data: ID <- c("480", "480", "620", "620","712","712") Year <- c("0", "1", "0", "1","0", "1") Plot <- c("14", "14", "13", "13","20","20") Treat <- c("0", "0", "0", "1", "0", "1") Exp <- c("31", "43", "44", "36", "29", "71") ExpSqrt <- c("5.567764", "6.557439", "6.633250", "6.000000", "5.385165", "8.426150") Winter <- data.frame

Oracle SQL - How to get distinct rows using RANK() or DENSE_RANK() or ROW_NUMBER() analytic function?

两盒软妹~` 提交于 2019-12-03 16:47:53
I am looking to get the top 3 distinct salaries of each department. I was able to do it either using RANK() or DENSE_RANK() or ROW_NUMBER() but my table is having some records with same salaries. Mentioned below is my query and its result. The top 3 salaries of Dept 20 should be 6000, 3000, 2975. But there are 2 employees with salary 3000 and both of them have rank 2. So it is giving me 4 records for this department (1 for rank 1, 2 records for rank2 and 1 record for rank3). Please suggest/advise about how can get the distinct top 3 salaries for each department. Query: SELECT * FROM ( SELECT

MySQL - ranking by count() and GROUP BY

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 16:18:39
I've got my mysql table posts , where all posts of my forum are stored. It's like this: id uid thread post title text time (int) (int) (varchar) (int) (varchar) (text) (int) Now I want to show the rank (ranking of number of posts) on the user profiles. I've tried something like this: set @rownum := 0; SELECT @rownum := @rownum + 1 AS rank, uid, count(id) FROM `posts` GROUP BY uid ORDER BY count(id) But it returns not the right data. The uid and count(id) match, but the rank is wrong. My entry is like: rank uid count(id) 1 1 214 I'm user 1, and I've got 214 posts, but that's not rank 1. There

Voting algorithm: how to calculate rank?

故事扮演 提交于 2019-12-03 16:13:37
I am trying to figure our a way to calculate rank. Right now it simply takes ratio of wins / losses of each individual entry, so e.g. one won 99 times out of a 100, it has 99% winning rank. BUT if an entry won 1 out of total 1 votes, it will have a 100% winning rank, but definitely it can't be higher that of the one that won 99 times. What would be a better way to do this? Depending on how complicated you want to make it, the Elo system chess uses (or something similar) may be what you want: http://en.wikipedia.org/wiki/Elo_rating_system Even if a person has won 1/1 matches, his rating would

如何使用Intellij IDEA开发Maven项目?

空扰寡人 提交于 2019-12-03 15:01:49
这里使用的Intellij IDEA的版本是14.1.1,使用maven构建的项目是 Rank , rank是一个seo工具,用于分析网站的搜索引擎收录排名。 1、将项目FORK到自己的GITHUB主页,如何FORK参考这里的 入门指南 链接,然后从自己的GITHUB账户下检出代码,要将下面的ysc换成你的GITHUB账户名称: 2、从现存源码新建一个项目: 3、找到项目保存的位置: 4、选择Maven: 5、选中“Import Maven projects automatically": 6、选择项目: 7、JDK必须是1.8: 8、项目名称: 9、选择第一个New Window: 10、从左面项目导航区找到相应的类, 在右面代码区单击右键,运行main方法 : 11、在下面的控制台输出窗口就会有日志,如果想控制日志的详细程度,则修改左面的项目导航区中的日志配置文件src/main/resources/logback.xml: 来源: oschina 链接: https://my.oschina.net/u/121944/blog/402634

Subgraph layout in graphviz

ε祈祈猫儿з 提交于 2019-12-03 15:01:23
I have code to display two subgraphs: graph { rankdir=LR; subgraph cluster01 { label="t=0" a0 [label="A"]; a1 [label="B"]; a2 [label="C"]; a5 [label="E"]; a0 -- a1; a1 -- a2 ; a2 -- a0; }; subgraph cluster02 { label="t=10" b0 [label="A"]; b5 [label="E"]; b1 [label="B"]; b2 [label="C"]; b0 -- b1; b2 -- b5; }; a0--b0 [style=dotted]; a1--b1 [style=dotted]; a2--b2 [style=dotted]; a5--b5 [style=dotted]; } This code displays two subgraphs like this: But I want to have it like this: I hope someone will help me fix the "rankdir" to get it done. The following was achieved by using invisible edges and

How to show bars in ggplot2 in descending order of a numeric vector?

依然范特西╮ 提交于 2019-12-03 10:03:09
问题 df <- data.frame (Categories=c("Alpha Category", "Alpha Category", "Alpha Category", "Bravo Category", "Bravo Category", "Bravo Category", "Charlie Category", "Charlie Category", "Charlie Category"), choices=c("alpha1", "alpha2", "alpha3", "bravo1", "bravo2", "bravo3", "charlie1", "charlie2", "charlie3") , ratings=c(20,60,40, 55,75,25,65,35,45)) df.plot <- ggplot(df, aes(Categories, ratings, fill = choices)) + geom_bar(position="dodge", stat="identity") + coord_flip() df.plot <- df.plot +

How to show bars in ggplot2 in descending order of a numeric vector?

╄→гoц情女王★ 提交于 2019-12-02 23:17:50
df <- data.frame (Categories=c("Alpha Category", "Alpha Category", "Alpha Category", "Bravo Category", "Bravo Category", "Bravo Category", "Charlie Category", "Charlie Category", "Charlie Category"), choices=c("alpha1", "alpha2", "alpha3", "bravo1", "bravo2", "bravo3", "charlie1", "charlie2", "charlie3") , ratings=c(20,60,40, 55,75,25,65,35,45)) df.plot <- ggplot(df, aes(Categories, ratings, fill = choices)) + geom_bar(position="dodge", stat="identity") + coord_flip() df.plot <- df.plot + theme_classic(base_size = 16, base_family = "") + scale_fill_brewer(palette="Paired") df.plot <- df.plot +

Implementing a total order ranking in PostgreSQL 8.3

假如想象 提交于 2019-12-02 17:28:26
问题 The issue with 8.3 is.....rank is introduced in 8.4. consider the numbers [10,6,6,2] I wish to achieve a rank of those numbers where the rank is equal to the the row number Rank,score 1, 10 2,6 3,6 4,2 A partial solution is to self join and count items with a higher or equal, score. this produces 1,10 3,6 3,6 4,2 this is not what I want. Is there a way to rank, or even just order by score then somehow extract the row number? 回答1: If you want a row number equivalent to the window function row

SQL rank percentile

為{幸葍}努か 提交于 2019-12-02 13:59:00
I've made an SQL query which rank pages by how many times they have been viewed. For instance, ╔══════╦═══════╗ ║ PAGE ║ VIEWS ║ ╠══════╬═══════╣ ║ J ║ 100 ║ ║ Q ║ 77 ║ ║ 3 ║ 55 ║ ║ A ║ 23 ║ ║ 2 ║ 6 ║ ╚══════╩═══════╝ Now what I would like to do is find the percentile rank of each page using an SQL query. The math I would like to use for this is simple enough, I just want to take the row number of the already generated table divided by the total number of rows. Or 1 minus this value, depending on my interests. Can I do a COUNT(pages) on an already generated table like this? I realize that's