Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Praveen Kumar M praveenkumarpgiindia

🎯
Focusing
Block or report user

Report or block praveenkumarpgiindia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@praveenkumarpgiindia
praveenkumarpgiindia / CI_vs_CP.R
Created Oct 28, 2018 — forked from Lakens/CI_vs_CP.R
confidence intervals vs capture percentages
View CI_vs_CP.R
if(!require(ggplot2)){install.packages('ggplot2')}
library(ggplot2)
n=20 #set sample size
nSims<-100000 #set number of simulations
x<-rnorm(n = n, mean = 100, sd = 15) #create sample from normal distribution
#95%CI
CIU<-mean(x)+qt(0.975, df = n-1)*sd(x)*sqrt(1/n)
View PlotScopusData.R
require(ggplot2)
#Save downloaded Scopus data in your working directory
scopusdata<-read.csv("scopusPS2010_2015.csv")
plot1<-ggplot(scopusdata, aes(x=Cited.by)) +
geom_histogram(colour="#535353", fill="#84D5F0", binwidth=2) +
xlab("Number of Citations") + ylab("Number of Articles") +
ggtitle("Citation Data for Psychological Science 2011-2015") +
coord_cartesian(xlim = c(-5, 250))
@praveenkumarpgiindia
praveenkumarpgiindia / Meta-Analysis in R
Created Oct 28, 2018 — forked from Lakens/Meta-Analysis in R
Perform a meta-analysis in R
View Meta-Analysis in R
#Script based on Carter & McCullough (2014) doi: 10.3389/fpsyg.2014.00823
#Load Libraries
library(meta)
library(metafor)
#Insert effect sizes and sample sizes
es.d<-c(0.38,0.41,-0.14,0.63,0.22)
n1<-c(75,48,22,18,60)
n2<-c(75,52,21,20,55)
@praveenkumarpgiindia
praveenkumarpgiindia / 4study_meta_50%_true_effects.R
Created Oct 28, 2018 — forked from Lakens/4study_meta_50%_true_effects.R
Internal meta-analysis on 4 studies, 50% of which are true effects
View 4study_meta_50%_true_effects.R
if(!require(meta)){install.packages('meta')}
library(meta)
nSims <- 1000000 #number of simulated experiments
numberstudies<-4 # nSim/numberofstudies should be whole number
p <-numeric(nSims) #set up empty container for all simulated p-values
metapran <-numeric(nSims/numberstudies) #set up empty container for all simulated p-values for random effects MA
metapfix <-numeric(nSims/numberstudies) #set up empty container for all simulated p-values for fixed effects MA
heterog.p<-numeric(nSims/numberstudies) #set up empty container for test for heterogeneity
d <-numeric(nSims) #set up empty container for all simulated d's
View p-value_misconceptions_figures.R
options(scipen=999) #disable scientific notation for numbers
#Figure 1 & 2 (set to N <- 5000 for Figure 2)
# Set x-axis upper and lower scalepoint (to do: automate)
low_x<--1
high_x<-1
y_max<-2
#Set sample size per group and effect size d (assumes equal sample sizes per group)
N<-50 #sample size per group for indepndent t-test
@praveenkumarpgiindia
praveenkumarpgiindia / emailing_students_from_R.R
Created Oct 28, 2018 — forked from Lakens/emailing_students_from_R.R
Emailing students from R using mailR package
View emailing_students_from_R.R
#Load packages
library(readxl)
library(mailR)
#Read student data
info <- read_excel("student_names_email.xls",
sheet = 1,
col_names = TRUE)
#Loop from 1 to the number of email addresses in the spreadsheet
View metaanalysis.r
## meta analysis, sample size based
metaZn = function(zdisc,zrepl,ndisc,nrepl)
{
## calculate meta analysis Zscore
## zdisc and zrepl are zscores in the discovery and replication sets respectively
## ndisc and nrepl are sample sizes in the discovery and replication sets
wdisc = sqrt(ndisc)
wrepl = sqrt(nrepl)
( zdisc * wdisc + zrepl * wrepl )/sqrt( wdisc^2 + wrepl^2 )
}
View logistic_regression.R
# Load the raw training data and replace missing values with NA
training.data.raw <- read.csv('train.csv',header=T,na.strings=c(""))
# Output the number of missing values for each column
sapply(training.data.raw,function(x) sum(is.na(x)))
# Quick check for how many different values for each feature
sapply(training.data.raw, function(x) length(unique(x)))
# A visual way to check for missing data
@praveenkumarpgiindia
praveenkumarpgiindia / c_sharp_for_python.md
Created Aug 17, 2018 — forked from mrkline/c_sharp_for_python.md
An intro to C# for a Python developer. Made for one of my coworkers.
View c_sharp_for_python.md

C# For Python Programmers

Syntax and core concepts

Basic Syntax

  • Single-line comments are started with //. Multi-line comments are started with /* and ended with */.

  • C# uses braces ({ and }) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,

You can’t perform that action at this time.