inv_u_trend: Generation of an inverted-u trend

View source: R/inv_u_trend.R

inv_u_trendR Documentation

Generation of an inverted-u trend

Description

This function generates a time trend for given time points in the trial according to an inverted-u function.

Usage

inv_u_trend(j, lambda, N_peak, n_total, trend_mean, trend_var)

Arguments

j

Time points for which the trend should be generated.

lambda

Strength of time trend.

N_peak

Point at which the time trend switches direction in terms of overall sample size.

n_total

Total sample size in the trial.

trend_mean

Integer. In case of random time trends, the strength of the time trend will be generated from N(trend_mean, trend_var).

trend_var

Integer. In case of random time trends, the strength of the time trend will be generated from N(trend_mean, trend_var).

Details

The time trend is generated according to the function

f(j) = \lambda \cdot \frac{j-1}{N-1} \hspace{0.2cm} \mathrm{for} \hspace{0.2cm} j \leq N_p

f(j) = -\lambda \cdot \frac{j-N_p}{N-1} + \lambda \cdot \frac{N_p-1}{N-1} \hspace{0.2cm} \mathrm{for} \hspace{0.2cm} j > N_p

where N is the total sample size (parameter n_total) and N_p (parameter N_peak) indicates the point at which the trend switches direction.

Value

Time trend for time points j.

Author(s)

Marta Bofill Roig, Pavla Krotka


pavlakrotka/NCC documentation built on April 17, 2025, 3:11 a.m.