vit {MBESS}R Documentation

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, All.in.One = TRUE,  ylim = NULL,
xlim = NULL, ylab = "Score", xlab = "Occasion", main = "", 
plot.points = TRUE, draw.which.lines = "Observed", predicted.id = NULL,
predicted.occasion = NULL, predicted.score = NULL, 
predicted.data = NULL, pch = 16, points.cex = 0.7, lty = 1, lwd = 1, 
per.page.layout = rbind(c(1, 2, 3), c(4, 5, 6), c(7, 8, 9), c(10, 11, 12)),
points.col = "Black", lines.col = "Black", mar = c(2.2, 2, 1, 1), 
mgp = c(2.2, 1, 0), pty = "s", ...)

Arguments

id string variable of the column name of id
occasion string variable of the column name of id
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
All.in.One should trajectories be in a single or multiple plots
ylim optional limit of the ordinate (i.e., y-axis; see par)
xlim optional limit for the abscissa (i.e., x-axis; see par)
ylab label for the ordinate (i.e., y-axis; see par)
xlab label for the abscissa (i.e., x-axis; see par)
main main title of the plot
plot.points should the points be plotted
draw.which.lines draw the observed or predicted lines
predicted.id like id but for the predicted data
predicted.occasion like occasion but for the predicted data
predicted.score like score but for the predicted scores
predicted.data like Data but for the predicted data
pch plotting character(s); see par
points.cex size of the points (1 is the R default; see par)
lty type of line to be plotted
lwd width of line to be plotted
per.page.layout define the per-page layout when All.in.One==FALSE
points.col color(s) of the points
lines.col color(s) of the line(s)
mar adjusts the margin spacing (see par)
mgp adjusts the margin lines (see mgp)
pty plot region type (see par; "s" is square)
... optional plotting specifications

Details

This function makes visualizing individual trajectories simple. If the plot will be saved for a publication, it is best to call upon a device so that the file can be saved. See Devices (e.g., use pdf to save a PDF file of the figure). Data should be in the "univariate format" (i.e., the same format as lmer and nlme data.

Value

Returns a plot of individual trajectories with the specifications provided.

Note

At present, the use of predicted statements is limited (and not recommended).

Author(s)

Ken Kelley (Indiana University; KKIII@Indiana.Edu)

See Also

par, Devices, pdf, jpeg, bmg

Examples

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 line color is conditional on group membership.
vit(id="ID", occasion="Trial", score="Score", Data=Gardner.LD, 
group="Group", draw.which.lines="Observed", pch=16, 
points.col=c("Black"), lines.col=c("Black", "Blue"))

# Now line and plotting character are conditional on group membership
vit(id="ID", occasion="Trial", score="Score", Data=Gardner.LD, 
group="Group", draw.which.lines="Observed",  pch=16, 
points.col=c("Black", "Blue"), lines.col=c("Black", "Blue"))

# Now plotting character is different with same color lines.
vit(id="ID", occasion="Trial", score="Score", Data=Gardner.LD, 
group="Group", draw.which.lines="Observed",  pch=c(1, 16), 
points.col=c("Black"), lines.col=c("Black"))

# Point color and line color can be mixed (this feature may not 
# be useful very often, but the function is general nonetheless).
vit(id="ID", occasion="Trial", score="Score", Data=Gardner.LD, 
group="Group", draw.which.lines="Observed",  pch=16, 
points.col=c("Red", "Orange"), lines.col=c("Black", "Blue"))

# Now randomly selects 50% of the sample to plot
vit(id="ID", occasion="Trial", score="Score", Data=Gardner.LD, 
pct.rand=50, group="Group", draw.which.lines="Observed",  pch=16)

# 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", 
lines.col=c("Black", "Blue"), pch=16)


[Package MBESS version 0.0.7 Index]