Learn R Programming

MBESS (version 4.1.0)

vit: Visualize individual trajectories

Description

A function to help visualize individual trajectories in a longitudinal (i.e., analysis of change) context.

Usage

vit(id = "", occasion = "", score = "", Data = NULL, group = NULL, subset.ids = NULL, pct.rand = NULL, number.rand = NULL, All.in.One = TRUE, ylab = NULL, xlab = NULL, same.scales = TRUE, plot.points = TRUE, save.pdf = FALSE, save.eps = FALSE, save.jpg = FALSE, file = "", layout = c(3, 3), col = NULL, pch = 16, cex = 0.7, ...)

Arguments

id
string variable of the column name of id
occasion
string variable of the column name of time variable
score
string variable of the column name where the score (i.e., dependent variable) is located
Data
data set with named column variables (see above)
group
if plotting parameters should be conditional on group membership
subset.ids
id values for a selected subset of individuals
pct.rand
percentage of random trajectories to be plotted
number.rand
number of random trajectories to be plotted
All.in.One
should trajectories be in a single or multiple plots
ylab
label for the ordinate (i.e., y-axis; see par)
xlab
label for the abscissa (i.e., x-axis; see par)
same.scales
should the y-axes have the same scales
plot.points
should the points be plotted
save.pdf
save a pdf file
save.eps
save a postscript file
save.jpg
save a jpg file
file
file name and file path for the graph(s) to save, if file="" a file would be saved in the current working directory
layout
define the per-page layout when All.in.One=FALSE
col
color(s) of the line(s) and points
pch
plotting character(s); see par
cex
size of the points (1 is the R default; see par)
...
optional plotting specifications

Value

Returns a plot of individual trajectories with the specifications provided.

Details

This function makes visualizing individual trajectories simple. Data should be in the "univariate format" (i.e., the same format as lmer and nlme data.)

See Also

par, nlme, vit.fitted,

Examples

Run this code
## Not run: 
# data(Gardner.LD)
# 
# # Although many options are possible, a simple call to
# # 'vit' is of the form:
# # vit(id="ID", occasion= "Trial", score= "Score", Data=Gardner.LD)
# 
# # Now color is conditional on group membership.
# # vit(id="ID", occasion= "Trial", score="Score", Data=Gardner.LD, 
# # group="Group")
# 
# # Now randomly selects 50
# # vit(id="ID", occasion= "Trial", score="Score", Data=Gardner.LD, 
# # pct.rand=50, group="Group")
# 
# # Specified individuals are plotted (by group)
# # vit(id="ID", occasion= "Trial", score="Score", Data=Gardner.LD, 
# # subset.ids=c(1, 4, 8, 13, 17, 21), group="Group")
# 
# # Now colors for groups are changed .
# # vit(id="ID", occasion= "Trial", score="Score", Data=Gardner.LD, 
# # group="Group",subset.ids=c(1, 4, 8, 13, 17, 21), col=c("Green", "Blue"))
# 
# # Now each individual specified is plotted separately.
# # vit(id="ID", occasion= "Trial", score="Score", Data=Gardner.LD, 
# # group="Group",subset.ids=c(1, 4, 8, 13, 17, 21), col=c("Green", "Blue"),
# # All.in.One=FALSE)
# ## End(Not run)

Run the code above in your browser using DataLab