out <- arimax(sub_s_t_series, order=c(2,0,1), xreg=sub_r_t_series,method = c("ML"))

and these are my coefficients:

Call arimax(x = sub_s_t_series, order = c(2, 0, 1), xreg = sub_r_t_series, method = c("ML"))

Coefficients: ar1 ar2 ma1 intercept xreg 1.4825 -0.6613 -0.8516 52745.107 -1.0132 s.e. 0.0295 0.0294 0.0064 40.828 0.0012

sigma^2 estimated as 0.08929: log likelihood = -105.98, aic = 221.97

All I am trying to do is to interpret the results. According to my understanding and the help given in the TSA package, the above ARIMAX(2,0,1) model is represented as follows:

sub_s_t_series_hat[k] = intercept + xreg*sub_r_t_series[k] + (a_t[k]+ma1*a_t[k-1])/(a_t[k]-ar1*a_t[k-1]-ar2*a_t[k-2]), (1)

where a_t are the residuals. When I use the following to measure the error/residuals myself

e_t = fitted(out)-sub_s_t_series_hat

e_t matches exactly to the values obtained by out[["residuals"]].

but when I use (1) as follows

e_t_hat = sub_s_t_series_hat - sub_s_t_series

e_t_hat does not match with out[["residuals"]], infact the results deviate by a magnitude of almost 4.

My questions is that: did an ARIMAX(2,0,1) fit would result in (1) or am I missing something?

BR, Wasif Masood PhD researcher! ]]>

In Chapter 12 , Experiments with Random Factors , of the book Design and Analysis of Experiments, written by Douglas C. Montgomery , at the end of the chapter , Example 12-2 is done by SAS . In Example 12-2 ,[ATTACH]Data of Example 12-2 [/ATTACH] , the model is a two-factor factorial random effect model .The output is given in Table 12-17

[ATTACH]Output[/ATTACH]

I am trying to fit the model in R by `lmer` .

Code:

`library(lme4)`

fit <- lmer(y~(1|operator)+(1|part),data=dat)

Code:

`est_ope=VarCorr(fit)$operator[1]`

est_part = VarCorr(fit)$part[1]

sig = summary(fit)$sigma

est_res = sig^2

Any help is appreciated . Thank you .

Code:

` library(lme4)`

model <- lmer(Reaction ~ Days + (1|Subject), sleepstudy)

Code:

` s2 <- VarCorr(model)$Subject[1]`

Many Thanks! Regards. ]]>