Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exam-statistics
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Simon Pintarelli
exam-statistics
Commits
3b9e1c3e
Commit
3b9e1c3e
authored
Aug 23, 2017
by
Simon Pintarelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add example
parent
cacd5258
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
example_stat_per_dep.R
example_stat_per_dep.R
+49
-0
No files found.
example_stat_per_dep.R
0 → 100644
View file @
3b9e1c3e
## statistics about grades, points per task grouped by department
max_points_per_task
<-
c
(
10
,
10
,
10
,
10
)
# max. no. of points per task
maxpoints
<-
sum
(
max_points_per_task
)
# max. points
dp
<-
0.5
# point interval
dg
<-
0.25
# grade interval
## piecewise linear grading scale. If no grade is assigned to 0 or maxpoints,
## it is assumed that they map to grade 1 or 6 respectively.
int_points
<-
c
(
0
,
maxpoints
)
int_grades
<-
c
(
1
,
6
)
library
(
dplyr
)
library
(
ggplot2
)
library
(
reshape
)
library
(
xtable
)
## read data
dset
<-
read.csv
(
'marks.csv'
,
encoding
=
'ISO-8859-1'
)
dset
<-
dset
[,
!
(
names
(
dset
)
%in%
c
(
"Last.Name"
,
"First.Name"
))]
dset
<-
melt
(
dset
,
id
=
c
(
"Number"
,
"Direction"
))
dset
$
value
<-
as.numeric
(
dset
$
value
)
total_points
<-
group_by
(
dset
,
Number
,
Direction
)
%>%
summarize
(
s
=
sum
(
value
))
linscale
<-
data.frame
(
approx
(
int_points
,
int_grades
,
seq
(
0
,
maxpoints
,
by
=
dp
)))
## join grading scale with total_points by using an auxiliary column with integer values
FUZZY
<-
1e6
linscale
$
jj
<-
as.integer
(
round
(
linscale
$
x
*
FUZZY
))
scale
<-
data.frame
(
grade
=
floor
(
linscale
$
y
*
1
/
dg
)
*
dg
,
jj
=
linscale
$
jj
)
## add integer column to total_points
total_points
$
jj
<-
as.integer
(
round
(
total_points
$
s
*
FUZZY
))
grades
<-
data.frame
(
left_join
(
x
=
total_points
,
y
=
scale
,
by
=
"jj"
))
grades
<-
grades
[,
c
(
"Number"
,
"Direction"
,
"s"
,
"grade"
)]
## grade cdf by Direction
ggplot
(
grades
,
aes
(
x
=
grade
,
color
=
Direction
))
+
stat_ecdf
()
+
scale_x_continuous
(
breaks
=
seq
(
1
,
6
,
by
=
1
))
+
coord_cartesian
(
xlim
=
c
(
1
,
6
))
## grade density by Direction
dev.new
()
ggplot
(
grades
,
aes
(
x
=
grade
,
color
=
Direction
))
+
geom_density
(
trim
=
TRUE
)
+
coord_cartesian
(
xlim
=
c
(
1
,
6
))
## mark density by Direction
dev.new
()
ggplot
(
dset
,
aes
(
x
=
value
,
color
=
Direction
))
+
geom_density
(
trim
=
TRUE
)
+
facet_wrap
(
~
variable
)
+
xlab
(
"Points"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment