I am trying to run the following code but gets error in last line only. Can anybody tell me what wrong I am doing. I took the code from an article, it goes well untill I cook the model with dynr.cook()
function.
The article is as follows.
What’s for dynr: A Package for Linear and Nonlinear Dynamic Modeling in R by Lu Ou+, Michael D. Hunter+, and Sy-Miin Chow
# install.packages("dynr")
library(dynr)
data("EMG")
EMGdata <- dynr.data(EMG, id = 'id', time = 'time',
observed = 'iEMG', covariates = 'SelfReport')
recMeas <- prep.measurement(
values.load = rep(list(matrix(1, 1, 1)), 2),
values.int = list(matrix(4, 1, 1), matrix(3, 1, 1)),
params.int = list(matrix('mu_1', 1, 1), matrix('mu_2', 1, 1)),
values.exo = list(matrix(0, 1, 1), matrix(1, 1, 1)),
params.exo = list(matrix('fixed', 1, 1), matrix('beta_2', 1, 1)),
obs.names = c('iEMG'),
state.names = c('eta'),
exo.names = c("SelfReport"))
head(EMG)
recDyn <- prep.matrixDynamics(
values.exo = list(matrix(1, 1, 1), matrix(1, 1, 1)),
params.exo = list(matrix('zeta1', 1, 1), matrix('zeta_2', 1, 1)),
values.dyn = list(matrix(.1, 1, 1), matrix(.5, 1, 1)),
params.dyn = list(matrix('phi_1', 1, 1), matrix('phi_2', 1, 1)),
covariates = 'eta' , isContinuousTime = FALSE)
recNoise <- prep.noise(values.latent = matrix(1, 1, 1),
params.latent = matrix('dynNoise', 1, 1),
values.observed = matrix(0, 1, 1), params.observed = matrix('fixed', 1, 1))
recReg <- prep.regimes(values = matrix(c(0.7, -1, 0, 0), 2, 2),
params = matrix(c('c11', 'c21', 'fixed', 'fixed'), 2, 2))
recIni <- prep.initial(
values.inistate = matrix(0, 1, 1),
params.inistate = matrix('fixed', 1, 1),
values.inicov = matrix(1, 1, 1),
params.inicov = matrix('fixed', 1, 1),
values.regimep = c(1, 0),
params.regimep = c('fixed', 'fixed'))
Oi, Chap! I found 1 regime for 'values.inistate' but 2 regimes elsewhere, so I extended the initial states to match.
If this is what you wanted, all is sunshine and puppy dogs.
Oi, Chap! I found 1 regime for 'values.inicov' but 2 regimes elsewhere, so I extended the initial covariances to match.
If this is what you wanted, all is sunshine and puppy dogs
rsmod <- dynr.model(dynamics = recDyn, measurement = recMeas,
noise = recNoise, initial = recIni, regimes = recReg,
data = EMGdata, outfile = "RSLinearDiscreteYang.c")
yum <- dynr.cook(rsmod)
Setting PKG_CPPFLAGS to -I"/include"
Setting PKG_LIBS to -L"/lib/x64" -lgsl -lgslcblas
Compilation argument:
C:/PROGRA~1/R/R-36~1.1/bin/x64/R CMD SHLIB RSLinearDiscreteYang.c 2> RSLinearDiscreteYang.c.err.txt
Warning message:
In system(cmd) : 'make' not found
ERROR(s) during compilation: source code errors or compiler configuration errors!
Program source:
1: #include <math.h>
Error in CompileCode(code, language, verbose, libLFile) :
Compilation ERROR, function(s)/method(s) not created! Warning message:
In system(cmd) : 'make' not found