SlideShare una empresa de Scribd logo
1 de 4
#------------------------------------------------------------------------------------# REFsim by D V M Bishop
# Simulates impact of REF on university income
# 13/10/13
#------------------------------------------------------------------------------------# Plots funding income for each university over each funding cycle
# Assumes greater funding allows higher-level academics are appointed
# You can vary the following:
# N universities (Nunis)
# Nstaff per university (Nstaff; currently constant for all unis)
# turnover ; proportion of staff changing over each cycle
# nrounds ; number of cycles of hiring/REF
# cutoff; mycut dimension: zscores corresponding to 1*,2*,3*,4* the higher cut[4] is, the fewer will
meet 4*
# starwt; dimension specifying weighting given to each star level
# budget; arbitrary - currently kept constant at each cycle
# plotdec; determines whether plot shows all unis or grouped into deciles
# results also depend on unipower, which is computed below
# unipower determines how spending power relates to calibre of new academics
# it's a weighted z-score of income
Nacads=10000; #total pool of academics
Nunis=100
Nstaff=50

# N universities
#Nstaff per uni

turnover=.1; #% staff change each run
turnstaff=round(turnover*Nstaff)
nrounds=6;
mycut=c(-1,0,1,2)
#zscorecutoffs for 1star, 2star,3star and 4star
#determines the percentage of cases meeting criteria for each star band
starwt=c(0,0,1,9)
#determines the weighting given to each star in funding formula band
budget=5000; #arbitrary number to keep total spend constant over time
plotdec=0; #set to one to plot decile ranges rather than all unis
uniall=matrix(rep(0,nrounds*Nunis),nrow=Nunis)#initialise matrix
#------------------------------------------------------------------------acadscore=rnorm(n=Nacads, m=0, sd=1) #random normal distribution of outputs
#assign academics to universities
acaduni = matrix(
sample(acadscore,Nstaff*Nunis), # the data elements
nrow=Nunis ,

# number of rows

ncol=Nstaff,

# number of columns

byrow = TRUE)

#--------------------------------------------------------------# initialise funds to zero for all
#--------------------------------------------------------------fundsuni=matrix(rep(0,Nstaff*Nunis),
nrow=Nunis, ncol=Nstaff)
#------------------------------------------------------------#
# loop start here
#-----------------------------------------------------------for (thisround in 1:nrounds){
fourstar=which(acaduni>mycut[4])
threestar=which(acaduni>mycut[3])
twostar=which(acaduni>mycut[2])
onestar=which(acaduni>mycut[1])
fundsuni[onestar]=starwt[1]
fundsuni[twostar]=starwt[2];
fundsuni[threestar]=starwt[3];
fundsuni[fourstar]=starwt[4];

unirawtotalincome=rowSums(fundsuni) #income per uni not adjusted for budget
unitotalincome=budget*unirawtotalincome/sum(unirawtotalincome) #adjusted for budget

#uncomment lines below to show histogram
# mytitle=c('round',thisround,'totalspend',sum(unitotalincome))
# hist(unitotalincome,main=mytitle,breaks=10)

#readline("Press <return> on console to continue")

incmean=mean(unitotalincome)
incsd=sd(unitotalincome)

unipower=(unitotalincome-incmean)/(incsd*.75) #formula that relates income to
# calibre of new staff

for (thisuni in 1:Nunis){
changestaff=sample(1:Nstaff,turnstaff)
acaduni[thisuni,changestaff]=acaduni[thisuni,changestaff]+unipower[thisuni]
}
uniall[,thisround]=unitotalincome
}
# for plotting sort the unis by income
unisorted=(uniall[order(uniall[,1]),] )

pickuni=seq(1,Nunis,by=10)#pick every 10th uni
uniall2=(unisorted[pickuni,]+unisorted[pickuni+1,]+unisorted[pickuni+2,]+unisorted[pickuni+3,]+unis
orted[pickuni+4,]+unisorted[pickuni+5,]+unisorted[pickuni+6,]+unisorted[pickuni+7,]+unisorted[pick
uni+8,]+unisorted[pickuni+9,])/10
mytitle=t(c('Weights: 1*=',starwt[1],"; 2*=",starwt[2],'; 3*=',starwt[3],'; 4*=',starwt[4]))
mydata=uniall #default plot all unis
if (plotdec==1){
mydata=uniall2 #otherwise plot decile bands

}
matplot(t(mydata),type='l',lwd=2,las=1,xlab='Cycle',ylab='Income',main=paste(mytitle,collapse=''),co
l=1,lty=2,ylim=c(0,300))

Más contenido relacionado

La actualidad más candente

Read/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into RRead/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into RRsquared Academy
 
Gate level minimization (1st update)
Gate level minimization (1st update)Gate level minimization (1st update)
Gate level minimization (1st update)Aravir Rose
 
Game and Search
Game and SearchGame and Search
Game and SearchAdri Jovin
 
First step of Performance Tuning
First step of Performance TuningFirst step of Performance Tuning
First step of Performance Tuningrisou
 
Read data from Excel spreadsheets into R
Read data from Excel spreadsheets into RRead data from Excel spreadsheets into R
Read data from Excel spreadsheets into RRsquared Academy
 

La actualidad más candente (8)

Introduction to tibbles
Introduction to tibblesIntroduction to tibbles
Introduction to tibbles
 
Read/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into RRead/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into R
 
Gate level minimization (1st update)
Gate level minimization (1st update)Gate level minimization (1st update)
Gate level minimization (1st update)
 
เซต
เซตเซต
เซต
 
Game and Search
Game and SearchGame and Search
Game and Search
 
First step of Performance Tuning
First step of Performance TuningFirst step of Performance Tuning
First step of Performance Tuning
 
Read data from Excel spreadsheets into R
Read data from Excel spreadsheets into RRead data from Excel spreadsheets into R
Read data from Excel spreadsheets into R
 
Presentation1
Presentation1Presentation1
Presentation1
 

Similar a Refsim (R program)

Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsOdoo
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersEnkitec
 
Math primar primary 3 المراجعة النهائية لنصف العام
Math primar primary 3 المراجعة النهائية لنصف العام Math primar primary 3 المراجعة النهائية لنصف العام
Math primar primary 3 المراجعة النهائية لنصف العام أمنية وجدى
 
Color Palettes in R
Color Palettes in RColor Palettes in R
Color Palettes in RMichel Alves
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersRiyaj Shamsudeen
 

Similar a Refsim (R program) (8)

Sql2
Sql2Sql2
Sql2
 
Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo apps
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-Developers
 
Math primar primary 3 المراجعة النهائية لنصف العام
Math primar primary 3 المراجعة النهائية لنصف العام Math primar primary 3 المراجعة النهائية لنصف العام
Math primar primary 3 المراجعة النهائية لنصف العام
 
SQLQueries
SQLQueriesSQLQueries
SQLQueries
 
Input output
Input outputInput output
Input output
 
Color Palettes in R
Color Palettes in RColor Palettes in R
Color Palettes in R
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineers
 

Más de Dorothy Bishop

Exercise/fish oil intervention for dyslexia
Exercise/fish oil intervention for dyslexiaExercise/fish oil intervention for dyslexia
Exercise/fish oil intervention for dyslexiaDorothy Bishop
 
Open Research Practices in the Age of a Papermill Pandemic
Open Research Practices in the Age of a Papermill PandemicOpen Research Practices in the Age of a Papermill Pandemic
Open Research Practices in the Age of a Papermill PandemicDorothy Bishop
 
Language-impaired preschoolers: A follow-up into adolescence.
Language-impaired preschoolers: A follow-up into adolescence.Language-impaired preschoolers: A follow-up into adolescence.
Language-impaired preschoolers: A follow-up into adolescence.Dorothy Bishop
 
Journal club summary: Open Science save lives
Journal club summary: Open Science save livesJournal club summary: Open Science save lives
Journal club summary: Open Science save livesDorothy Bishop
 
Short talk on 2 cognitive biases and reproducibility
Short talk on 2 cognitive biases and reproducibilityShort talk on 2 cognitive biases and reproducibility
Short talk on 2 cognitive biases and reproducibilityDorothy Bishop
 
Otitis media with effusion: an illustration of ascertainment bias
Otitis media with effusion: an illustration of ascertainment biasOtitis media with effusion: an illustration of ascertainment bias
Otitis media with effusion: an illustration of ascertainment biasDorothy Bishop
 
Insights from psychology on lack of reproducibility
Insights from psychology on lack of reproducibilityInsights from psychology on lack of reproducibility
Insights from psychology on lack of reproducibilityDorothy Bishop
 
What are metrics good for? Reflections on REF and TEF
What are metrics good for? Reflections on REF and TEFWhat are metrics good for? Reflections on REF and TEF
What are metrics good for? Reflections on REF and TEFDorothy Bishop
 
Biomarkers for psychological phenotypes?
Biomarkers for psychological phenotypes?Biomarkers for psychological phenotypes?
Biomarkers for psychological phenotypes?Dorothy Bishop
 
Data simulation basics
Data simulation basicsData simulation basics
Data simulation basicsDorothy Bishop
 
Simulating data to gain insights into power and p-hacking
Simulating data to gain insights intopower and p-hackingSimulating data to gain insights intopower and p-hacking
Simulating data to gain insights into power and p-hackingDorothy Bishop
 
Talk on reproducibility in EEG research
Talk on reproducibility in EEG researchTalk on reproducibility in EEG research
Talk on reproducibility in EEG researchDorothy Bishop
 
What is Developmental Language Disorder
What is Developmental Language DisorderWhat is Developmental Language Disorder
What is Developmental Language DisorderDorothy Bishop
 
Developmental language disorder and auditory processing disorder: 
Same or di...
Developmental language disorder and auditory processing disorder: 
Same or di...Developmental language disorder and auditory processing disorder: 
Same or di...
Developmental language disorder and auditory processing disorder: 
Same or di...Dorothy Bishop
 
Fallibility in science: Responsible ways to handle mistakes
Fallibility in science: Responsible ways to handle mistakesFallibility in science: Responsible ways to handle mistakes
Fallibility in science: Responsible ways to handle mistakesDorothy Bishop
 
Improve your study with pre-registration
Improve your study with pre-registrationImprove your study with pre-registration
Improve your study with pre-registrationDorothy Bishop
 
Introduction to simulating data to improve your research
Introduction to simulating data to improve your researchIntroduction to simulating data to improve your research
Introduction to simulating data to improve your researchDorothy Bishop
 
Southampton: lecture on TEF
Southampton: lecture on TEFSouthampton: lecture on TEF
Southampton: lecture on TEFDorothy Bishop
 
Reading list: What’s wrong with our universities
Reading list: What’s wrong with our universitiesReading list: What’s wrong with our universities
Reading list: What’s wrong with our universitiesDorothy Bishop
 
IJLCD Winter Lecture 2016-7 : References
IJLCD Winter Lecture 2016-7 : ReferencesIJLCD Winter Lecture 2016-7 : References
IJLCD Winter Lecture 2016-7 : ReferencesDorothy Bishop
 

Más de Dorothy Bishop (20)

Exercise/fish oil intervention for dyslexia
Exercise/fish oil intervention for dyslexiaExercise/fish oil intervention for dyslexia
Exercise/fish oil intervention for dyslexia
 
Open Research Practices in the Age of a Papermill Pandemic
Open Research Practices in the Age of a Papermill PandemicOpen Research Practices in the Age of a Papermill Pandemic
Open Research Practices in the Age of a Papermill Pandemic
 
Language-impaired preschoolers: A follow-up into adolescence.
Language-impaired preschoolers: A follow-up into adolescence.Language-impaired preschoolers: A follow-up into adolescence.
Language-impaired preschoolers: A follow-up into adolescence.
 
Journal club summary: Open Science save lives
Journal club summary: Open Science save livesJournal club summary: Open Science save lives
Journal club summary: Open Science save lives
 
Short talk on 2 cognitive biases and reproducibility
Short talk on 2 cognitive biases and reproducibilityShort talk on 2 cognitive biases and reproducibility
Short talk on 2 cognitive biases and reproducibility
 
Otitis media with effusion: an illustration of ascertainment bias
Otitis media with effusion: an illustration of ascertainment biasOtitis media with effusion: an illustration of ascertainment bias
Otitis media with effusion: an illustration of ascertainment bias
 
Insights from psychology on lack of reproducibility
Insights from psychology on lack of reproducibilityInsights from psychology on lack of reproducibility
Insights from psychology on lack of reproducibility
 
What are metrics good for? Reflections on REF and TEF
What are metrics good for? Reflections on REF and TEFWhat are metrics good for? Reflections on REF and TEF
What are metrics good for? Reflections on REF and TEF
 
Biomarkers for psychological phenotypes?
Biomarkers for psychological phenotypes?Biomarkers for psychological phenotypes?
Biomarkers for psychological phenotypes?
 
Data simulation basics
Data simulation basicsData simulation basics
Data simulation basics
 
Simulating data to gain insights into power and p-hacking
Simulating data to gain insights intopower and p-hackingSimulating data to gain insights intopower and p-hacking
Simulating data to gain insights into power and p-hacking
 
Talk on reproducibility in EEG research
Talk on reproducibility in EEG researchTalk on reproducibility in EEG research
Talk on reproducibility in EEG research
 
What is Developmental Language Disorder
What is Developmental Language DisorderWhat is Developmental Language Disorder
What is Developmental Language Disorder
 
Developmental language disorder and auditory processing disorder: 
Same or di...
Developmental language disorder and auditory processing disorder: 
Same or di...Developmental language disorder and auditory processing disorder: 
Same or di...
Developmental language disorder and auditory processing disorder: 
Same or di...
 
Fallibility in science: Responsible ways to handle mistakes
Fallibility in science: Responsible ways to handle mistakesFallibility in science: Responsible ways to handle mistakes
Fallibility in science: Responsible ways to handle mistakes
 
Improve your study with pre-registration
Improve your study with pre-registrationImprove your study with pre-registration
Improve your study with pre-registration
 
Introduction to simulating data to improve your research
Introduction to simulating data to improve your researchIntroduction to simulating data to improve your research
Introduction to simulating data to improve your research
 
Southampton: lecture on TEF
Southampton: lecture on TEFSouthampton: lecture on TEF
Southampton: lecture on TEF
 
Reading list: What’s wrong with our universities
Reading list: What’s wrong with our universitiesReading list: What’s wrong with our universities
Reading list: What’s wrong with our universities
 
IJLCD Winter Lecture 2016-7 : References
IJLCD Winter Lecture 2016-7 : ReferencesIJLCD Winter Lecture 2016-7 : References
IJLCD Winter Lecture 2016-7 : References
 

Último

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 

Último (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

Refsim (R program)

  • 1. #------------------------------------------------------------------------------------# REFsim by D V M Bishop # Simulates impact of REF on university income # 13/10/13 #------------------------------------------------------------------------------------# Plots funding income for each university over each funding cycle # Assumes greater funding allows higher-level academics are appointed # You can vary the following: # N universities (Nunis) # Nstaff per university (Nstaff; currently constant for all unis) # turnover ; proportion of staff changing over each cycle # nrounds ; number of cycles of hiring/REF # cutoff; mycut dimension: zscores corresponding to 1*,2*,3*,4* the higher cut[4] is, the fewer will meet 4* # starwt; dimension specifying weighting given to each star level # budget; arbitrary - currently kept constant at each cycle # plotdec; determines whether plot shows all unis or grouped into deciles # results also depend on unipower, which is computed below # unipower determines how spending power relates to calibre of new academics # it's a weighted z-score of income Nacads=10000; #total pool of academics Nunis=100 Nstaff=50 # N universities #Nstaff per uni turnover=.1; #% staff change each run turnstaff=round(turnover*Nstaff) nrounds=6; mycut=c(-1,0,1,2)
  • 2. #zscorecutoffs for 1star, 2star,3star and 4star #determines the percentage of cases meeting criteria for each star band starwt=c(0,0,1,9) #determines the weighting given to each star in funding formula band budget=5000; #arbitrary number to keep total spend constant over time plotdec=0; #set to one to plot decile ranges rather than all unis uniall=matrix(rep(0,nrounds*Nunis),nrow=Nunis)#initialise matrix #------------------------------------------------------------------------acadscore=rnorm(n=Nacads, m=0, sd=1) #random normal distribution of outputs #assign academics to universities acaduni = matrix( sample(acadscore,Nstaff*Nunis), # the data elements nrow=Nunis , # number of rows ncol=Nstaff, # number of columns byrow = TRUE) #--------------------------------------------------------------# initialise funds to zero for all #--------------------------------------------------------------fundsuni=matrix(rep(0,Nstaff*Nunis), nrow=Nunis, ncol=Nstaff) #------------------------------------------------------------# # loop start here #-----------------------------------------------------------for (thisround in 1:nrounds){ fourstar=which(acaduni>mycut[4]) threestar=which(acaduni>mycut[3])
  • 3. twostar=which(acaduni>mycut[2]) onestar=which(acaduni>mycut[1]) fundsuni[onestar]=starwt[1] fundsuni[twostar]=starwt[2]; fundsuni[threestar]=starwt[3]; fundsuni[fourstar]=starwt[4]; unirawtotalincome=rowSums(fundsuni) #income per uni not adjusted for budget unitotalincome=budget*unirawtotalincome/sum(unirawtotalincome) #adjusted for budget #uncomment lines below to show histogram # mytitle=c('round',thisround,'totalspend',sum(unitotalincome)) # hist(unitotalincome,main=mytitle,breaks=10) #readline("Press <return> on console to continue") incmean=mean(unitotalincome) incsd=sd(unitotalincome) unipower=(unitotalincome-incmean)/(incsd*.75) #formula that relates income to # calibre of new staff for (thisuni in 1:Nunis){ changestaff=sample(1:Nstaff,turnstaff) acaduni[thisuni,changestaff]=acaduni[thisuni,changestaff]+unipower[thisuni] } uniall[,thisround]=unitotalincome
  • 4. } # for plotting sort the unis by income unisorted=(uniall[order(uniall[,1]),] ) pickuni=seq(1,Nunis,by=10)#pick every 10th uni uniall2=(unisorted[pickuni,]+unisorted[pickuni+1,]+unisorted[pickuni+2,]+unisorted[pickuni+3,]+unis orted[pickuni+4,]+unisorted[pickuni+5,]+unisorted[pickuni+6,]+unisorted[pickuni+7,]+unisorted[pick uni+8,]+unisorted[pickuni+9,])/10 mytitle=t(c('Weights: 1*=',starwt[1],"; 2*=",starwt[2],'; 3*=',starwt[3],'; 4*=',starwt[4])) mydata=uniall #default plot all unis if (plotdec==1){ mydata=uniall2 #otherwise plot decile bands } matplot(t(mydata),type='l',lwd=2,las=1,xlab='Cycle',ylab='Income',main=paste(mytitle,collapse=''),co l=1,lty=2,ylim=c(0,300))