I'm trying to create hypothetical parameters to run the following simulation in r;
library(nlme)
ITS.single.group = function(y, time, time.intrv1, time.intrv2, pchi, smallmodel, greatmodel){
# y is response;
# time is observation time;
# time.intrv1+1 is the time point of the first intervention;
# time.intrv2+1 is the time point of the second intervention
# pchi is the critical value rejecting the hypothesis
# *************************************************************************
# great model involves the small model,
# for example greatmodel = formula(y ~ time + x1 + x2 + time1:x1 + time2:x2)
# and smallmodel = formula(y~time)
# *************************************************************************
nsmp = length(y)
x1 = c(rep(0,time.intrv1), rep(1,nsmp-time.intrv1))
x2 = c(rep(0,time.intrv2), rep(1,nsmp-time.intrv2))
time1 = time-time.intrv1-1
time2 = time-time.intrv2-1
fit.small = gls(smallmodel, correlation=corAR1(form=~1), method = "ML")
# fit small model
fit.great = gls(greatmodel, correlation=corAR1(form=~1), method = "ML")
# fit great model
dif = fit.great$logLik - fit.small$logLik
rej = (2*dif > pchi)
rej
}
Can anyone help with hypothetical parameters that I can use to run the model?