clpm_poly_r {crosslag}R Documentation

Title Nonlinear Cross Lag Analysis based on Polynomial linear regression: autoregression

Description

Title Nonlinear Cross Lag Analysis based on Polynomial linear regression: autoregression

Usage

clpm_poly_r(xname, yname, data1, data2, adjust = FALSE, adjust_name = NULL)

Arguments

xname

If cross lagged analysis is used between x and y, 'xname' is the name of x

yname

If cross lagged analysis is used between x and y, 'xname' is the name of x

data1

A dataframe containing data of x and y at the same time point. If covariate adjustments are made (adjust=T), data of covariates should also be included. The input 'xname','yname' and 'adjust_name' is written in the same way among the 'data1' column names

data2

A dataframe containing data of x and y at the another time point. If covariate adjustments are made (adjust=T), data of covariates should also be included. The input 'xname','yname' and 'adjust_name' is written in the same way among the 'data2' column names

adjust

The default value is F. If you want to perform covariate adjustments on x and y based on adjust_target(), please use T.

adjust_name

The name of the covariate, corresponding to the data contained in data1 or data2. If there are multiple covariates, they need to be saved in a vector.

Value

A dataframe containing the result of Nonlinear Cross Lag Analysis after polynomial regression: Xt~X1,Yt~Y1

Examples

data(test_data1)
data(test_data2)
# Not adjusting for covariates
result <- clpm_poly_r(xname = "ASI",yname = "PWRI",
                      data1 = test_data1,data2 = test_data2,adjust = FALSE)
# Adjust for covariates
result_ad <- clpm_poly_r(xname = "ASI",yname = "PWRI",
                         data1 = test_data1,data2 = test_data2,
                         adjust = TRUE,adjust_name=c("HDL_C","LDL_C"))

[Package crosslag version 0.1.0 Index]