Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbetebenner/00b454d02cacbee3b6a5 to your computer and use it in GitHub Desktop.
Save dbetebenner/00b454d02cacbee3b6a5 to your computer and use it in GitHub Desktop.
SGP Calculation using previously created coefficient matrices
### Load SGP Package and SGPdata
require(SGP)
require(SGPdata)
### Create two sets of data from embedded sgpData from, for example, grade 6:
### 1. Data for initial coefficient matrix creations
### 2. Data to be used with coefficient matrices created in 1.
grade.6.data <- subset(sgpData, GRADE_2015==6)
### original.analysis.data will consist of all data except for last 100 rows
original.analysis.data <- head(grade.6.data, -100)
### additional.analysis.data will consist of the last 100 rows
additional.analysis.data <- tail(grade.6.data, 100)
### Now run initial analyses
my.grade.sequences <- list(3:6)
my.sgpData <- list(Panel_Data=original.analysis.data) ### Put original.analysis.data into Panel_Data
for (i in seq_along(my.grade.sequences)) {
my.sgpData <- studentGrowthPercentiles(
panel.data=my.sgpData,
sgp.labels=list(my.year=2015, my.subject="Reading"),
grade.progression=my.grade.sequences[[i]])
}
### The SGPs from this run are at:
percentiles.1st.run <- my.sgpData$SGPercentiles$READING.2015
### The coefficient matrices are in my.sgpData$Coefficient_Matrices
### The additional analysis will add the add results to the currently existing data in my.sgpData$SGPercentiles$READING.2014
### First put additional data in Panel_Data & then run the analyses
my.sgpData$Panel_Data <- additional.analysis.data
for (i in seq_along(my.grade.sequences)) {
my.sgpData <- studentGrowthPercentiles(panel.data=my.sgpData,
sgp.labels=list(my.year=2015, my.subject="Reading"),
use.my.coefficient.matrices=list(my.year=2015, my.subject="Reading"),
grade.progression=my.grade.sequences[[i]])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment