visualizeTrajectories: Function for visualizing trajectories generated by...

Description Usage Arguments Details See Also Examples

View source: R/visualizeTrajectories_function.r

Description

visualizeTrajectories plots synthetic growth trajectories using ggplot2.

Usage

1
2
3
4
5
6
visualizeTrajectories(
  trajectories,
  showTransitions = FALSE,
  timerange = NULL,
  version = NULL
)

Arguments

trajectories

An object of class ZPD produced by the ZPDGrowthTrajectories() function. If needed, this object be converted internally to "long" format suitable for ggplot.The function returns a ggplot object that can be modified with typical ggplot2 arguments.

showTransitions

Logical. Should vertical lines be drawn when the school curriculum changes? Defaults to FALSE

timerange

Optional numeric vector providing limits for the x axis. Defaults to NULL.

version

Optional numeric vector for plotting trajectories only for specific version(s) of the curriculum. For example, c(1,2) indicates that only trajectories for versions 1 and 2 should be plotted

Details

visualizeTrajectories plots the trajectories generated by the ZPDGrowthTrajectories() function. The figure plots achievement versus time and represents each student's trajectory using a different colored line.

See Also

describeTrajectories for calculating summary statistics of the generated trajectories.

ZPDGrowthTrajectories for simulating growth trajectories.

Other visualizations: visualizeContext(), visualizeHome(), visualizeSchool(), visualizeZPD()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# learning rate
learn.rate <- c(.08, .10, .12, .18)

# decay rate
decay.rate <- c(.04, .03, .02, .01)

# initial achievement
initial.ach <- rep(0, times=4)

# quality of home environment
home.env <- c(.06, .12, .15, .20)

# assignment object simulating starting kindergarten on time 801
#  Kindergarten for 200 days, followed by 100 days of summer
#  then 200 days of first grade
assignment <- c(rep(0, times=800), rep(1, times=200),
                rep(0, times=100), rep(2, times=200))

# define school curriculum
curriculum.start.points <- list(
    # "typical curriculum" start points for K and first grade
  matrix(c(.2, .26), nrow=2, ncol=1),
    # "advanced curriculum" start points for K and first grade
  matrix(c(.22, .29), nrow=2, ncol=1)
)

curriculum.widths <- list(
  # "typical curriculum" widths for K and first grade
  matrix(c(.04, .04), nrow=2, ncol=1),
  # "advanced curriculum" widths for K and first grade
  matrix(c(.05, .05), nrow=2, ncol=1)
)

curriculum.review.slopes <- list(
  # "typical curriculum" review slopes for K and first grade
  matrix(c(30, 30), nrow=2, ncol=1),
  # "advanced curriculum" review slopes for K and first grade
  matrix(c(60, 60), nrow=2, ncol=1)
)

curriculum.advanced.slopes <- list(
  # "typical curriculum" advanced slopes for K and first grade
  matrix(c(50, 50), nrow=2, ncol=1),
  # "advanced curriculum" advanced slopes for K and first grade
  matrix(c(25, 25), nrow=2, ncol=1)
)

# students 1 and 2 get typical curriculum, 3 and 4 get advanced
which.curriculum <- c(1,1,2,2)

 y <- ZPDGrowthTrajectories(learn.rate=learn.rate, home.env=home.env,
                        decay.rate=decay.rate, initial.ach=initial.ach,
                        ZPD.width=.05, ZPD.offset=.02,
                        home.learning.decay.rate=6,
                        curriculum.start.points=curriculum.start.points,
                        curriculum.widths=curriculum.widths,
                        curriculum.review.slopes=curriculum.review.slopes,
                        curriculum.advanced.slopes=curriculum.advanced.slopes,
                        assignment=assignment, dosage=.8,
                        adaptive.curriculum=FALSE,
                        which.curriculum=which.curriculum,
                        school.weight=.5, home.weight=1, decay.weight=.05,
                        verbose=TRUE)
visualizeTrajectories(y)

visualizeTrajectories(y, timerange=c(500, 700))

mcbeem/ZPDGrowthTrajectories documentation built on May 18, 2020, 2:04 p.m.