Replies: 1 comment 1 reply
-
Hi @huyo1444 - You can write the math like this: library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
code <- '
$PARAM X1 = 50, X2 = 4, X3 = -2, X4 = 12, X5 = 2, X6 = 4, X7 = 19
$ERROR
double A = X2 * cos(2 * M_PI * (TIME + X3)/X4);
double B = X5 * cos(2 * M_PI * (TIME + X6)/X7);
capture Y = X1 + A + B;
'
mod <- mcode("circ", code)
#> Building circ ...
#> done.
mrgsim(mod, end = 72, delta = 0.1) %>% plot() Created on 2024-04-29 with reprex v2.0.2 If there are other components that need to get hooked up in the model, you'll have to give us more information on that. Kyle |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to incorprate circadina rhythem in my PKPD model on mrgsolve.
That's why, I need to express the equation as below:
Y = X1 + X2cos(2π*(TIME + X3)/X4)+X5cos(22π(TIME + X6)/X7)
(XNs are variables)
I'm appriciate if anyone provied me an answer.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions