change violin plot

This commit is contained in:
zhangxunhui 2021-11-20 22:20:54 +08:00
parent ca299842b1
commit 6b0b94722c
13 changed files with 1422 additions and 251 deletions

View File

@ -62,7 +62,7 @@ m_commit_num_sponsor_account_create_time = lmer(
# scale(log(history_pr_num+0.5)) +
# scale(log(history_issue_num+0.5)) +
scale(log(history_discussion_num+0.5)) +
scale(log(history_sponsored_num+0.5)) +
# scale(log(history_sponsored_num+0.5)) +
scale(log(history_star_num+0.5)) +
# scale(log(min_tier+0.5)) +
# scale(log(max_tier+0.5)) +
@ -96,7 +96,7 @@ m_discussion_num_sponsor_account_create_time = lmer(
# scale(log(history_pr_num+0.5)) +
# scale(log(history_issue_num+0.5)) +
scale(log(history_discussion_num+0.5)) +
scale(log(history_sponsored_num+0.5)) +
# scale(log(history_sponsored_num+0.5)) +
scale(log(history_star_num+0.5)) +
# scale(log(min_tier+0.5)) +
# scale(log(max_tier+0.5)) +

View File

@ -0,0 +1,96 @@
# ------------------------------------------------------------------
# aim: answer to what extent does sponsor motivates you (for maintainers only)
# author: zxh
# date: 2021-07-21
library(RMySQL)
library(yaml)
dbConfig <- yaml.load_file('config.yaml')
db_user <- dbConfig$mysql$user
db_password <- dbConfig$mysql$passwd
db_name <- dbConfig$mysql$db
db_host <- dbConfig$mysql$host # for local access
db_port <- as.numeric(dbConfig$mysql$port)
conn <- dbConnect(MySQL(), user = db_user, password = db_password,
dbname = db_name, host = db_host, port = db_port)
# 首先定义所有的motivation
# 1. maintainer:
maintainer_motivations = c(
"It allows users of my projects to express thanks/appreciation",
"Sponsorship can motivate my future OSS contribution",
"Side income for OSS contribution",
"It can reflect community recognition for my work",
"Just for fun",
"I deserve to be rewarded for my past OSS contribution",
"I am able to prioritize the requirements of sponsors (e.g., fixing bugs)",
"Its a way for me to make a living"
)
# 读取所有motivation以及对应的motivate_extent
q = "select reason.login as login, reason.value as reason, basic.motivate_extent as extent from questionnaire_results_maintainer_2_set_up_reasons reason, questionnaire_results_maintainer_2_basic basic where reason.login=basic.login"
rs <- dbSendQuery(conn, q)
df <- fetch(rs, n = -1)
df = df[df$reason %in% maintainer_motivations,]
# df_likert$A <- factor(df_likert$A, levels = c("1", "2", "3", "4", "5"), ordered = TRUE)
# 1. 取出所有值为某个motivation的所有likert scale
likert_scales = c()
for (motivation in maintainer_motivations) {
append(likert_scales, df$extent[df$reason == motivation])
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# aim: draw likert scale plot for two dimentions
# author: zxh
# date: 2021-07-21
library(RMySQL)
library(yaml)
dbConfig <- yaml.load_file('config.yaml')
db_user <- dbConfig$mysql$user
db_password <- dbConfig$mysql$passwd
db_name <- dbConfig$mysql$db
db_host <- dbConfig$mysql$host # for local access
db_port <- as.numeric(dbConfig$mysql$port)
conn <- dbConnect(MySQL(), user = db_user, password = db_password,
dbname = db_name, host = db_host, port = db_port)
# 首先定义所有的motivation
# 1. maintainer:
maintainer_motivations = c(
"It allows users of my projects to express thanks/appreciation",
"Sponsorship can motivate my future OSS contribution",
"Side income for OSS contribution",
"It can reflect community recognition for my work",
"Just for fun",
"I deserve to be rewarded for my past OSS contribution",
"I am able to prioritize the requirements of sponsors (e.g., fixing bugs)",
"Its a way for me to make a living"
)
# 2. sponsor:
sponsor_motivations = c(
"Because I benefit from the developers projects",
"To encourage the developer to continue the contribution",
"To show my recognition of the developers work",
"Because Im interested in the developers projects",
"To motivate the developer to work harder on a specific feature",
"Because I know the developer"
)
# read all the motivations and likert results
# 1. maintainer
q = "select * from questionnaire_results_maintainer_2_set_up_reasons reason"
rs <- dbSendQuery(conn, q)
df <- fetch(rs, n = -1)
# ------------------------------------------------------------------

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
print("pause")

View File

@ -13,7 +13,7 @@ library(dplyr)
library(pscl)
require(MASS)
dbConfig <- yaml.load_file('R/config.yaml')
dbConfig <- yaml.load_file('config.yaml')
db_user <- dbConfig$mysql$user
db_password <- dbConfig$mysql$passwd
db_name <- dbConfig$mysql$db
@ -126,7 +126,7 @@ model = lm(
data=df
)
# hurdle regression (glm + lm)
# hurdle regression (glm + glm.nb)
# 1. glm whether has sponsor or not
df$has_sponsor[df$sponsored_num > 0] = 1
df$has_sponsor[df$sponsored_num == 0] = 0

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.