Description Usage Arguments Value Examples
A conceptual extension to the ccf() function. Computes corrleation coeffeicients for various leads and lags between an x and y variable, for longitudinal data were observations are nested within an 'id' variable.
1 2 3 |
n |
Number of lead/lags to compute up to |
y |
Y variable |
x |
X variable |
id |
id variable, unique across pts. |
data |
data.frame containing all data |
outputdata |
If TRUE, a data.frame containing all lead and lag variables appended to the right |
singlecor |
If TRUE, will output the lead/lag correlations for the specified n separately |
plot |
If TRUE, a plot of all correlations will be drawn |
onlylead |
If TRUE, only leads will be estimated, no lags |
main |
Main title for plot, if plot==TRUE |
sub |
Sub title for plot, if plot==TRUE |
xlab |
X-axis label for plot, if plot==TRUE |
ylab |
Y-axis label for plot, if plot==TRUE |
yscale |
Y scale for plot, if plot==TRUE |
data.frame with new data and/or a plot of correllation coefficients.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #get<-function(){
#id<-sort(rep(1:200, 50))
#time<-rep(1:50,200)
#main<-(rnorm(10000, 7.4,2.2))
#effect<-time*.85
#y<-main + effect
#return(data.frame(id,time,y))
#}
#df <- get()
#longitudinalccf(n = 15,
# y = y,
# x = time,
# id = id,
# data = df,
# plot=TRUE,
# outputdata=TRUE,
# singlecor=FALSE,
# onlylead=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.