3
$\begingroup$

I am working on measuring and plotting a health metric (e.g. Blood pressue) everyday (multiple times every day).

I tag everyday's reading with some tags that happened that day e.g. [run, smoke] (which means I ran for sometime, and I smoked a cigarette that day).

Is there a way to measure time-delayed response of say [smoke] on health metric [Blood pressure]. I can't look for health metrics tagged with [smoke], as that would only show values of metrics on the day I smoked. I want to know, and plot, value of health metric, and how it has changed after the event (smoke) happened.

How do I measure this using R.

I am very new to this. Is there a technical term for what I am trying to do.

$\endgroup$

2 Answers 2

1
$\begingroup$

You are looking for lagged values of a predictor.

Of course, it's rather non-trivial to find out whether a lag of one day is "better" than a lag of two days or three days... or whether the "best" variate to include is the average of values lagged by one and two days.

$\endgroup$
0
$\begingroup$

If you have multiple regressors (tags) that can take values of TRUE or FALSE for each day, then Vector Autoregression might find a time-lagged relationship between the tags.

The "vars" CRAN package will help you search for the best lag time using "VARSelect" function and the "VAR" function can generate multiple linear models that are a function of your lagged tags. Have a look at Hyndman's chapter on Vector Autoregression here for some examples:

https://www.otexts.org/fpp/9/2

You could then look at the coefficients of each linear model to see what tags have a strong influence (if any) on other tags.

Of course if a person has smoked or had high blood pressure then that lagged tag is likely to predict that they will continue to smoke or have high blood pressure.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.