Repeated measurement analysis with Stata (2023)

Repeated measurement analysis with state

Data: From far away

Repeated data measurements are available in two different formats: 1) width or 2) length. In the broad format, each topic appears once with repeated damage to the same damage. For long -term data, there is an observation for eachsubject.It is an example of a broad format four times.

ID y1 y2 y3 y4 1 3.5 4.

In the aboveY1The response variable is the first time. In a long way, they look like it.

Identification time and 1 3.5 1 2 4.5 1 3 7.5 2 1 6.5 2 5.5 2 3 8.5 2 4 8.5

Remember that time is an explicit variable with long data. This format means data period data by some researchers.

The Stata analyzes repeated measurements for ANOVA and for linear mixed models of a long way.On the other side, SAS and SPSS usually analyze the repeated measurement -Tattova in great shape.

The sample data set

Our data registration example is mentioned with skillRepeated measuresand can be loaded with the next command.

Use https://stats.idre.ucla.edu/stat/data/repeated_measures, of course

There are a total of eight individuals who are measured four times. These data are a broad format whereY1It is the answer in time 1,EYIt is the answer in time 2 and so on. Subjects are divided into two groups of four individuals using the variables using the variablesTrt.Laá, they are the basic descriptive statistics in each of the four times the treatment group combined and broke.

Take Y1-Y4 togetherVariable | Note Medios STD.Dev.min Max ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.751.101946 2 5.5 Y3 | 8 6.5 1.253566 5 8.5 Y4 | 8 9.25 1.101946 7.5 11An apple of 11 rays begins) (or Geuth)Summary Statistics: N, Media, SD, Variation According to Categories: TRT TRT | Y1 Y3 Y4 ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 | 4 4 | 4.25 4.5 7.5 8.5 | 1.5 .8164966 .8164966 .8164966 | 2.25 .66667.6667.66667 --------------------------------------- 4 4 4 | 1.753 5.5 10 | .816496.5773503 .8164966 | .25 .666667 .333333 .666667 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------1,101946 | 2.857143 1.571429 1.214286 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------

Then we will approach the eight cells with the user command.PerfilPlotYou can download this command enteringTAL PERFILPLOTIt's the Stata command window.

PerfectPlot Y1-Y4, Von (TRT)Repeated measurement analysis with Stata (1)

Now, let's take a look at the correlation and covariance matrices of the answers over time.

Korrelate Y1-Y4(OB = 8) | y1 y2 y3 y4 ------------------------------------------------------------------------------------- Y1 | 1.0000 Y2 | 0,8820 1.0000 Y3 | 0,91020,8273 1.0000 Y4 | -5752- 0,6471 -0,5171 1.0000Y1-Y4, Related Cov(OB = 8) | y1 y2 y3 y4 ----------------------------------------------------------------------------------------- Y1 | 2.85714 y2 | 1.64286 1.21429 y3 | 1.92857 1.14286 1.57143 y4 |-1.07143 -785714 -714286 1.21429

The ANOVA of repeated measurement assumes that the covariance structure within the subjects is metric.More than we discussed the subject of the subject in the presentation.

Redesign change from afar for a long time

After looking at some of the descriptive statisticsredesignCommand.HeEU()The option indicates the variable that identifies the subject while theJ ()The option creates a new variable that shows the period.

Long E, I (ID) Reform (Time)(Note: J = 1 2 3 4) Width data-> Lang ------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------List, SEP (4)5. -----------------O > ine |Ex-------------------------------------------ry traical -WO.101 11 13 3,5 |111 11 11 4,5 33.101 3 3 1 7,5 |111 14 17, |Ex----------------------------------------ryble.JHO 21 1. 1. 6.2. 2 11 5, |JO2 2 3 1. 8.5 |JO2 2. 1. 8. –• |---------------------------O ) gigil 99.ARE 33 11 13, | 400.ARE 33 2 2 1 4, – 11.ARE 33 3 3 11 7, – 12.ARE 33 4 19, |--------------------------------------maARE Y. 14 13,5 |S44 2 1. 3.ARE 44 3 3. 1. 6.5 16.ARE 44 4. 1. 8. |Ex------------------------------------------ryble.ARE 55 10 1 2 1 1O 18.ARE 55 5 2 2 2 GO ̀19.ARE 55 5 3 2 2 5 EO 200.4.--------------------------------ma--2ARE 66 1 1 2 2 GO ̀22.ARE 66 6 2 2 3 ? 223.ARE 66 3 3 2 6 GO 24.ARE 66 6 40 20 |Ex------------------------------------27. 1 1 2 2 2O 26.7. 2 2 2 4 |7 7 7 3 2 5 ) |7. 4 4 29 9O |--------------------------------ma--28.8 1 1 2 2 GO 300.8.8 2 2 3 3: 311.88 8 3 3 2 6 32.8.

After the redesign of the data, we can continue with repeated measurements.

Repeated measures ANOVA

In the use of the ANOVA language, this design has the subjects and among the effects of the subjects, ie, a model with mixed effects. In particular, this design is sometimes known as an analysis of variation with the shared factorial plot.In this the long data.

In general, the rule is that there is a single concept of error for all subjects of the subject and a separate error term for each of the subject factors and the interaction of factors in the subjects' subjects.

Our model is relatively simple, with only two. The intermediate effect of the subject is the treatment (Trt) and its concept of error is nestled in treatment (Id |Trt) .The time of factoring within the subjectTempoThe concept of error is the residual error for the model.

(Video) Repeated One-way ANOVA in STATA

Repeated measurements The ANOVA presupposes that the subject within the symmetry of the subject's kovariance structure is also described as interchangeable. In composed symmetry, the variations are expected each time and all covariable should be the same.of the subject is not related to the symmetrical that was preserved from repeated measurements.repeated ()Option inANOVACommand that calculates P values for conservative F tests.

Later, we will discuss covariance structures in the presentation.

Here is thisANOVACommand for our data.

One -and -Tard /Laughter Treat Treat # Ri, Krammaja (PG)) Sad))Number NOTE = 32 R square = 0.9624 ROOT MSE = 0.712 ADJ R-Square = 0.9352 Source | SS Partial DF MS F PROG> F ---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ TRT | 9,375 6 1.5625 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Zeit | 194.8333333 127,89 0.0000 TRT#Hour | 19,375 3 6.4583333 12.74 0.0001 | Rest | 9,125 18 .5069444 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- among individuals with error: id |TRT levels: 8 (6 df) Bass B.S.E.Variable: Id-kovarine grouped through: TRT (Repeated Variable) Repeated Variable: Zeit Huynh-Feldt Epsilon = 0.9432 Greenhouse= 0, 3333 ---- -------------------- BOX G-G-G-G- Cashier ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0000 0.0000 0.0000 TRT#hour | 3 12.74 0.0002 0.0019 0.0118 REST | 18 ---- --------- -------------------------------------------------------------------------------------

The interaction for treating treatments is significant as well as the two main effects for treatment and time.Production includes P values for three different conservative tests F: 1) Huynh-Feldt, 2) Gewächshaus-geisser and 3) Conservative boxes F. These values are indicators for P values, even if the data is not accepted corresponding toComposite symmetry.SrepHeadquarters.

Matrixist is (silver)Symphomet is (silver) SH, which 1 2 CZ 4P1 1.25p.

The inspection of the covariance matrix grouped in the subjects raises doubts about the validity of the assumption of composite symmetry, and the p values for conservative testing still have significant effects for theTRT #SesInteraction andTempoMain effect.

Simple effects tests

As the interaction of treatments, because time is significant, we must try to explain the interaction. A possibility of doing so, the use of simple effects tests is.

The effect of time with each treatment

The simple effect of time has three degrees of freedom for each level of treatment of a total of six degrees of freedom. This simple effect test uses residual straw for the model as a concept of error.ContrastCommand to test simple effects.

Contrasts @ TRT, effectMarginal Linear Predictions Contrasts: How Balance -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Zeit@TRT | 1 | 3 35.96 0.0000 2 | 3 104.670.0000 Plate | 6 70.32 0.0000 | Rest | 18 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------t | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------- (2 against the base)1 | .25 .5034602 0.626 -.80773307 1.307731 (2 vs base) 2 | 1.25 .5034602 2.48 0.02693 2.307731 (3 against the base) 1 | 3.25 .5034602 6, 46 0.19269 (3 vsBase) 2 | 3.75 .5034602 7.45 0.692269 4,807731 (4 4.25 .5034602 8.44 0000 3.19269 5.30777331 (4 vs base) 2 | 25 .5034602 16.39 0.39 0.307731- -----------------------------------------------------------------------------------------------------------------------------

I have parents -ups

Like each of the tests with simple effects includes four timesStripesCommand with himPWComparePossibility.

Margins, in (TRT = 1) pwcompare (effects), check on theCouple Predictive Margin Comparisons Sexpression: Linear forecast, predicted () In: TRT = 1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Z | [95% conf.Intervall] -------------------------------------------------------------------------------------------------------------------------------------- Time | 2 vs 1 | .25 .5034602 0.619-.736764 1.236764 3 Against 1 | 3.25 .5034602 6.46 0.46 263236 4,236764 Against 1 | 4.25 .5034602 8.44 0.44 5.236764 Against 2 | .5034602 5,000 2.013236 3.96444444444444 4. 4.-------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Margins, in (TRT = 2) pwcompare (effects) NostiepcheckIf Predictive Margin Comparisons Sexpression: Linear forecast, predicted () In: TRT = 2 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ IRREN.Z P> |Z | [95% conf.Intervall] ---------------------------------------------------------------------------------------------------------------------------------------- Time | 2 vs 1 | 1.25 .5034602 2.48 0.013.263236 2.236764 3 Against 1 | 3.75 .5034602 7.45 0.45 0.736764 4 vs 1 | 8.25 .5034602 16.39 0.000 7.236644 Against 1 |, 5 .5034602 4.000 1.501323236 3. 3 | 4.513236 5.486764-----------------------------------------------------------------------

ANOVA WITH A GROUP OF ERRORS

Treatment tests in each draw require the use of grouped errors.Id |Trtand the residual error. This is easy to eliminateId |TrtdoANOVACommand. It is not that the remaining degrees of freedom are now 24.

Anova y trt ## zeekNumber of obs = 32 R quoted = 0.9237 RUN MSE = 0.877971 ADJ R-Square = 0.9015 Source | Partial SS DF MS F Prog> F ------------+----------- ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------

The effect of treatment all the time

Now we can perform the simple effects of treatment at any time, again with theContrastCommand. As there are two levels of treatment all the time, there are a total of four degrees of freedom. As each test is a degree of freedom, we do not need to perform tests to follow -up.

TRT@Time Contrast, EffectMarginal Linear Predictions Contrasts: How Balance ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- TRT@time | 1 | 1 16,22 0,0005 2 | 15.84 0.0237 3 | 1 10.38 0.0036 4 | 1 5.84 0.0237 Plate | 4 9.57 0.0001 | Rest | 24 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------ | Contrast Std.irren.t P> |t | [95% conf.Intervall] -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------- (2 against the base) 1 | -2.6208194 -4.03 0.3.781308 -1.218692 (2 | -1,5 .6208194 -2.42 02.781308-. 2186918 (2 against the base) 3 | .6208194 -3.22 0.004 -3.71888888 (238194.1.5 .6208194 2.42 024 .2186918 2.781308 ------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------- ---------------------------------------------------------------------

Interaction charts

An interaction chart is always useful. We will use themStripesCommand eRandproduce the action.

Marges TRT #SesAdjusted Predictions Number of Note = 32 Expression: Linear forecast, predicted () --------------------------------------------------------------------------------------- ------------------------ Z | [95% conf.Intervall] --------------------------------------------------------------------------------------------- #time | 4.25 .4389856 9,000 3.389604 5.110396 1 2 | 4.5 .4389856 10,000 3.63960396 1 3 | 7.5 .4389856 17.000 6.639604 8.5.4389856 3,000 .8896041 2.610396 2 |3 .4389856 6,000 2.139604 3 | 5.5 .4389856 12.2.2.6390390 -------------------------------------------------------------------------------------------------------------Margin, of (time)Repeated measurement analysis with Stata (2)

Disadvantages of Repeated Measures Anova

Repeated measures that Anova suffers from various disadvantages, including.

(Video) Restructing repeated measures data in Stata from Wide format to Long format

  • does not allow unequal observations within the subject
  • The user must determine the correct error concept for each effect
  • The structure composed of symmetry/interchangeable covariance accepted

Mixed Model of Repeated Measures

An alternative to repeated Anova measurements is to perform the analysis as a repeated model.XtMixedDomain.We have to specify only the name of the variables for which the data is repeated in this caseI WENT.M.It isXtMixedThe command looks like.RemlOption for the results to be comparable to the results of Anova.

XtMixed y trt ## zeit ||Id :, var RemlRun the optimization in: Implementation of gradient base optimization: iteration 0: Trochelidhood log -re -restricted = -34.824381 Iteration 1: Restricted logstition = -34.824379 Computer Error: Mixed Remlh Effects Number of Note = 32 Group Variable: id- No.Group: min = 4 AVG = 4.0 max = 4 Chi2 Forest (7) = 428.37g of restricted probability = -34.824379 PROB> CHI2 = 0.0000 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---- and | coef.std.irren.z p> |Z | [95% conf.Intervall] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.1.283217 | 2 | .25 .5034603 0.619 -.736764 3 | 3.25 .5034603 6.46 0.000 4.236764 4 | 4.25 .5034603 8.44 0.000 3.236764 | TRT#| 1 .7122000 3 | .7120004 0.483 -.895495 2 4 .7120004 0.604505 5.395495 | _Cons | 4.25 .4389855 9,000 3.389604 5.110396 ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- random effect parameters | Estimation STD.IRREN. [95% Conf.Interval] ------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------ Identity | VAR (_con) | .263887 .2294499 .0480071 1.450562 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------VAR (rest) | .5069445 .1689815 .2637707 .9743036 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- LR test against linear regression: chibar2 (01) = 3.30 prob> = chibar2 = 0.0346

In addition to estimates of fixed effects, we receive two random effects. This variation of sections and residual variation, which corresponds to the corresponding variation between the subjects and the subjects' variants in the subjects.

XtMixedCreate estimates for each term in the model.ContrastDomain.

Contrast TRT ## ZEKMarginal Linear Predictions Contrasts: How Balance -------------------------------------------------------------------------------------------------------------------- DF Chi2- ----------------------------------- | TRT | 1 6.48 0109 | ZEIT | 3 383.67 0.0000 | TRT#Time | 3 38.22 0.0000 ---------------------------------------------------------------------------------------------------------------------

Interaction charts

Tell us the interaction with the same chartsStripesYRandCommands as before.

Marges TRT #SesPredictions Predicted Observations = 32 Expression: Linear, fixed, preventive () -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Mandrel.Z P> |Z |ZZ | [95% CONF.Intervall] -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #Time | 4.25 .4389855 9,000 3.3896045.110396 1 2 | 4.5 .4389855 10.000 3560396 1 3 | 7.5 .4389855 17.000 6.63960475 .4388855 3.000, 8896042 2.610396 2 | 3 .4388855 6,000 2.139604 3 | 5.860-860 ---------------------------------------------------------------------------------------------------------------------------------------------------------------Margin, of (time)Repeated measurement analysis with Stata (3)

Simple effects test

Once again, we can use tests with simple effects to understand significant interaction.

Time with each treatment

Contrasts @ TRT, effectMarginal Linear Predictions Contrasts: How Balance -------------------------------------------------------------------------------------------------------------------- DF Chi2- ----------------------------------- | Zeit@TRT | 1 | 3 107.88 0.0000 2 | 3 314.01 0.0000Plate | 6 421,89 0.0000 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------- Z | [95% Conf.Intervall] -------------------------------------- ------------------------------------------------------ and | Zeit@TRT |(2 against the base) 1 |25 .5034603 0.619 -736764 1.236764 (2 vs base) 2 | 1.25 .5034603 2.48 0.013 .263236 2.236764 (3 against the base) 1 | 3.25 .5034603 6, 46 0.263236 4,23664 (3) | 3.75 .5034603 7.45 0.763236 4,736764 (4 4.25 .5034603 8.44 0.44 0000 3.236764 (4 against the base) 16.39 0.39 7.263236 9.236764 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Since each of these tests uses three degrees of freedom with simple effects, we will track with pairs comparisons.

Margiers, in (TRT = 1) pwcompare (Effects)Compare in predictive adapted pairs: linear forecast, fixed part, prognosis () in: TRT = 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Time | 2 vs 1 | .25 .5034603 0.619 -.736764 1.236764 3 Against 1 | 3.25 .5034603 6.46 0000 263236 4.236764 Against 1 | 4.25 .5034603 8.44 0.4444 against 2 |35034603 5,000 2.013236 3.964646464 46660 4. 4.986764 4 Against 3 | 1 .5034603 1.9 047 .013236 1.986764 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Margonzes, EM (TRT = 2) PWCOMPARE (EFFECTS)Compare in predictive adapted pairs: linear forecast, fixed part, prognosis () in: TRT = 2 ------------------------------------------------------------------------------------------------------- ---------------------------- ----- Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ Time | 2 vs 1| 1.25 .5034603 2.48 0.013.25 .5034603 16.2632366764 3 Against 2 | 2.5 .5034603 4,000 1.501323236 3.4664644444 4 40 6.20 6.20 6. 4.5 .5034603 8.000 3.513236 5.486764 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Always treatment

TRT@Time Contrast, EffectMarginal Linear Predictions Contrasts: How Balance -------------------------------------------------------------------------------------------------------------------- DF Chi2- ----------------------------------- | TRT@time | 1 | 1 16,0001 2 | 1 5.84 0.0157 3 | 110.38 0.0013 4 | 1 5.84 0.0157 Plate | 4 44.70 0.0000 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------- and | TRT@time |(2 against the base) 1 | -2.6208193 -4.03 0.3.3.716783 -1.283217 (2 vs base) 2 | -1.5 .6208193 -2.42 0.016 -2.716783 -.2832165 (2 against the base) 3 | .6208193-3.22 0.001 -3.7832165 (2 vs base) 4 | 1.5 .6208193 2.42 0.016 .2832165 2.716783 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Post-Hoc Test of Trends

Another way to see these results is to analyze the trend over time for each of the two groups. We do this using themPag.Contrast operator that provides coefficients of orthogonal polynomy users. We keep the@Operator we use in simple effects tests to achieve results through treatment.

Contrast p.time@trt, effectMarginal Linear Prediction Contrast: How Balance --------------------------------------------------------------------------P> Chi2 ----------------------------------- E | zeit@trt | (linear) 1| 1 97.87 0,0000 (linear) 2 | 1 292.96 0.0000 (square) 1 | 1 1.11 0.2922 (square) 2 | 1 20.84 0.0000 (cubic) 1 | 1 8,90 0.0028 (cubic) 2 | 1 0.22 0.6376 Articulation | 6 421.89 0.0000 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z | [95% conf.Intervall] -------------------------------------------------------------------------------------------------- and | Zeit@TRT | (Linear) 1 | 1.760904 .1780001 9,000 1.41203 2.109777 (linear) 2 | 3.046643 .1780001 17.12 0.69769 3.395516 (square) 1 | .1875 0.292 -.16137373738 (quadratic) 2 || -5310611.2.98 0.003 -.879399 -.1821924 (Kubisch) 2 | .0838525 .1780001 0.638 -.265021263 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------

The results show a significant linear trend for treatment 1 and treatment 2. Treatment 2 has a significant square trend, while treatment 1 has a significant cubic trend.

Post-hoc test of partial interaction

Another alternative is to observe the partial interactions between treatment and time. We will see both treatments and twice for each test.To understand our partial interaction tests to understand the following test, the lines between time 2 and time 3 and the final test test with the two lines between 3 and time 4. For each partial interactions if the periodfour cell interaction are significant. The way to create partial interaction tests to use themA.(neighbor) contrast operator along with the#For interaction. The explanation is much more complex than the concept.

Kontrast A.Time#TRTMarginal linear prediction contrasts: How balance -------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- E | Zeit#TRT |(1 vs 2) (plate) | 1 1.97 0.1602 (2 against 3) | 1 0.49 0.4825 (3 against 4) | 1 24.16 0.0000 Plate | 3 38.22 0.0000 ------------------------------------------------------------------------------

The results show that there is no interaction between time 1 and time 2 or between 2 and time 3. However, there is an interaction between times 3 and 4.

Covariance structures within the subjects

We used to explain that we will return on the subject of Koreans within the subject, so we observed some of the possible covariance structures within the subjects.

independence

This covariance structure deals with the repeated effects as completely independent, as if the design were among the subjects.

A20 p20 0 p20 0 s2

Composite/interchangeable symmetry

(Video) How To Run REPEATED MEASURES ANOVA using STATA - FULL TUTORIAL + PRACTICE PROBLEM | Stata Tutorial

Repeated Measures Anava assumes that the covariance structure within the subject has symmetry. There is only one variation (σ2) Three times and there is only one covariance (σ1) For each of the test pairs, this is illustrated. Stata calls this interchangeable covariance structure.

A2A1A2A1A1A2A1A1A1A2

Unstructured

Increasingly has its variation for non -structured covariance (for example, σ12It is the variation of time 1) and every time they have their own cannum (for example, σ21It is the covariant of time 1 and time 2).

A12A21A22A31A32A32A41A42A43A42

The disadvantage of the use of an undiscovered covariance is the largest number of estimated parameters.

Autor -Comply

Another frequent covariance structure, which is often observed in repeated measurements, is a self -compressive structure that recognizes that observations that are more professional are more correlated than more scale measures that are later. Covariance Matrix.

A2S2σr2S2σr3σr2S2

It is also possible to have automatically compatible structures of 2 or 3 types. It is here that Stata also offers the covariance structures shown above the following covariance structures: sliding average, tied and toeplitz exponential.

Example with unstructured covariance

After inspecting a covariance matrix within the subjects, we decided to use an unm completed covariance within the subjects.

XtMixed y trt ## tiempo ||ID :, Var Noconst Residual (Unstr, T (Time)) RemlIitation 3: Restricted probability of registration = -30.075124 Iteration 4: Tidade -restriction log The iteration = -29.820951 iteration 5: Restricted probability of registration = -29.819621 Iteration 6: Logedliood -restricted restrict = -29.81962 Standard Error of Computer: mixtos Remlertresstresstresstresstressringrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrressionrension Remlime -numplorvon obs = 32 variável de grupo: número de identificamación de grupos = 8 obs por grupo: min = 4 avg = 4,0 máx = 4 bosque chi2 (7) = 247,94 log talavilidad limitead ------- --- --------------------------------------------- ----- -------------- ------------------------------------ -------------------------------- ------------- ------- - e |COEEF.STD.IRREN.Z P> | Z |[95% conf.intervall] ---------------------------------- ---- ----- ------------------------------------ .ttrt |-2.7905694 -3.16 0,002 -4.9505125 |Zeit |.25 .3818814 0,65 0,513 -.4984737 3 |3.25 .318812 8.51 0,0007 3.998473 4 |4.25 .6922186 6,14 0,000 2,893276 5.6067244 |.5400616 0,355 -.558501 2 4 .978945 4,09 0,000 2,081303 5.918697 |_Cons |4.25 .559017 7.000 3.154347 5.345653 ---------------------------------------------- ------------------------------------- --------------- -------------------------------------------- --------- ------------------------------------------- --------- ---------------------------------------- ------------- ---------------------------------------- ------------- ---------------------------------- -------- ------------ ------------------------------------------------ ----- --------------------------------------------- ------- ------- ---------- Parâmetros de efeitos aleatórios |Estimar std.inren.[95% conf.intervall] ------------------------------------------- --------------------------------- ---------------- --- --------------------------- ------------------------- ---------------------- ------------------------------ ----------------- ----------------------------------- ----------- -------------------- REST: não estruturado |Var (e1) |1.25 .721688 .4031515 3.875713 var (e2) |.6666687.215014 2.067049 var (e3) |.4999998 .2886746 .161266667 .2150142 2.067047 COV (E2) |.6666666 .4614796 -2378169 1.57115 COV (E1, E3)) |.33333334 .2721656 -.2001015 .8667682 COV (E4) |-.16666667 .28054181 .3831847 COV (E4) |.16666665656.------------- -------------------------------------- ----------- Teste LR contra a regressão linear: Chi2 (9) = 13.31Bewa> Chi2 = 0,1489 Nota: Os graus de liberdade informados se afastam do fato de que a hipótese nula não se deve à borda da vantagem de de O espaço dos parâmetros, se esse não é o FET, o teste informado é conservador.

Here is the common (multiple degree of freedom) for interaction.

Control space # TRT, effectMarginal Linear Predictions Contrasts: How Balance -------------------------------------------------------------------------------------------------------------------- DF Chi2- ------------------------------------ | TRT#hour | 3 35.58 0.0000 ----- ------------------------------------------------------------------

Simple Effects Tests: TRT@Time

As interaction is statistically significant, we will follow a simple time effects test for each treatment.

Contrasts @ TRT, effectMarginal Linear Predictions Contrasts: How Balance -------------------------------------------------------------------------------------------------------------------- DF Chi2- ---------------------------------- | Zeit@TRT | 1 | 3 100,99 0.0000 2 | 3 146.96 0.0000Plate | 6 247.94 0.0000 ----------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Z | [95% conf.Intervall] --------------------------------------------------------------------------- ----- -------------------------- and | Zeit@TRT |(2 against base) 1 |25 .3818814 0.65 0.513 -.4984737 .984737 (2 against the base) 2 | 1.25 .3818814 3.27 0.001 .5015263 1.998474 (3 against the base) 1 |25.3818812 8.51 0000 2.501527 3, 3, 998473 (3 | 3.75.------------------------------------------------------------------------------------

Growth models

Linear growth model

It is also possible to treat time as a continuous variable.In this case, the model looks like a linear growth model. To simplify Interpte's interpretation, we will be in zero instead of one.CtimewhichTempo- 1. We are goingXtMixedKnow what we are tryingCtimeLike the use ofC.Prefix.

Remember that when using a mixed model, the same times need not be measured for each subject, although in our case all are measured at the same four times.

Here is our linear growth model.

(Video) Repeated measures ANOVA ⏲⏲⏲

Generate Cime = Tempo - 1xmixed and TRT ## C.Ctime || Id :, varRun the optimization in: Implementation of gradient base optimization: iteration 0: Logaritur Veraz of OBS Regression = 32 Group Variable: Group Identification Number = 8 Note by group: min = 4 AVG = 4.0 max = max= max = max = max = max = max = max = max = max = max = max.--------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------- and | coef.std.irren.Z P> |Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------------ .TTRT | -2.6161878 -4.63 0.000 -4.642294Summit | 1,575 .276465 6.92 1.128821 2.021179 | TRT#C.Cime | 2 | 1.15.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------STD.IRREN. [95% interval conf.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ = chibar2 = 0.4149

As you can see, the concept of interaction remains statistically significant.TrtYCtimeAs the main effects in the sense of ANOVA.CtimeThe inclination ofYECtimeIn the reference group. During the coefficient forTrtIt is the difference in both groupsCtimeIt's zero.

Simple slopes

We can use themStripesCommand with himDydxOption to maintain earrings of each of the two treatment groups.Trt1 is the same as the coefficient forCtimeAbove.

Margen TRT, DYDX (Ctime)The average marginal effects of the OBS = 32 Expression: Linear predictions, fixed, predicted () DY/DX W.R.T.: CITME -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Term ”--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | TRT | 1 | 1,575 .2276465 6.92 1.128821 2,725 .22276465 ----------------------------------------------------------------------------------------------------------------------------------------

We can also prove the difference in the tracks with the testsStripesCommand with the coding of the reference group with theR.Contrast Operator. This is not really necessary, because we already know that the difference in inclinations is significant from the concept of previous interaction. Ch-squaresown below for circular error.

Margen R.trt, Dydx (Ctime)Contrasts of the average expression of marginal effect: linear forecast, fixed part, predicted () DY/DX W.R.T.: CTIME ------------------------------------------------------------ ---------------------------------------------------------------------------------------------------- | DF Chi2 P> Chi2 ----- ------------------------------------------------------------------------------------------------------------TRT | 1 12.76 0,0004 ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------------------------------------- 95% conf.] -------------------------------------------------------------------------------------------------------------------------------------------------------------------------TRT | (2 vs 1) | 1.15 .3219408 .5190076 1.780992-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Interaction charts

We can visualize the simple gradients that drama the interaction using a variation of graphicallyStripeswith himem()Option together with theRandDomain.

Margen Trt, Em (Tstime = (0 (1))) allPREVENTIONS OF OBSERVATION PREVERIES: LINEAR PREVISIONS, FIRT () 1._AT: 02._AT: SUME = 13._AT: In 24._T: SUMMARY = 3 ----------------------------------- ------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z P> |Z | [95% conf.Intervall] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #trt | 121,000 8,296023 10.00398 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------- -----Marginsplot, x (ctime)Repeated measurement analysis with Stata (4)

Square growth model

We do not need to limit ourselves to a linear relationship over time. We can easily accuse a square effect by repetitionC. PotimeTerm in our model.

XtMixed y trt ## c.cime ## c.ctime ||id :, varIn -Timization Execution: Gradient -based optimization Execution: Iteration 0: LOG PROBABILITY = -356298 Iteration 1: LOG PROBABILITY = -39.356273 Iteration 2: LOG PROBABILITY = -356273 Standard Computer Error: Mixed Effects ML Regression NO.8 Note by group.: Min = 4 AVG = 4.0 max = 4 Chi2 Forest (5) = 373.88 Log Prefers = -39.356273 Prob> Chi2 = 0.0000 ------------------------------------------------------------------------------------------------------------------------------------------------------------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------IRREN.Z P> |Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------1.01253778 1.71 0.087 -.1485391 2.173539 | TRT #C.CIME | #C.CTIME | .1875 .1892281 0.99 0.322 -.1833804 .55583804 |TRT#C.C.CTIME | 2 | .6267609 2.34 0.020 .100496 1.149504 | _Cons | 4.0125 .4165364 0.000 3.196104 4,82896 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ _Cons) | .1497396 .1522079 .020423 1.097916 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Test ContrA A Linear Regression: Chibar2 (01) = 1.71 Porb> = Chibar2 = 0.0958

Figure the square model

We can use the square model with the same chartStripesYRandCommands we use for the linear model

Margen Trt, Em (Tstime = (0 (1) h)) allPREVENTIONS OF OBSERVATION PREVERIES: LINEAR PREVISIONS, FIRT () 1._AT: 02._AT: SUME = 13._AT: In 24._T: SUMMARY = 3 ----------------------------------- ------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z P> |Z | [95% conf.Intervall] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #trt | 17.455646 3 2 || 5,6125, 3408973 16,000 4,944354 6.280646 4 1 | 8.7375364 20.98 0.000 7.553896 4 2 | 9.96364 23.92 0. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Marginsplot, x (ctime)Repeated measurement analysis with Stata (5)

KubikwachstumsModell

If we add an additionalCtimeIn our square growth model, we get a butchful growth model.

XtMixed y trt ## c.ctime ## c.ctime ## c.cime ||Id :, varRun the optimization in-Patimization in: Gradient-based optimization Execution: Iteration 0: Probability = -34.436022 Iteration 1: Loga Log LikeOod = -34.436022 ProB> Chi2 = 0.0000 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- and | coef.std.irren.z p> |Z | [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------)CTIME | -2.708333 1.182953 -2.026879 -.3897881 | TRT#C.CTIME | 2 | 3 |, 5833333 1.672948 2.032 .3044152 6.862251 | 1.045514 3.700831 5.799169 |-C.Ctime#C.Cime#C.Ctime | -791667 .2297971 -3.45 0.001 -1.242061 -.3412726 |TRT#C.C.CTIME#C.Cime | 2 | .916667 .3249822 2.82 0.005 .2797133 1.55362 | 4.25.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Crazy. [95% conf.Intervall] ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:.1979168 .1490322 .0452401 .8658471 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------- 215924 .6694872- ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------ LR test against linear regression: chibar2 (01) = 4.41 prob> = chibar2 = 0.0179

Cubic model charts

Margen Trt, Em (Tstime = (0 (1) h)) allPREVENTIONS OF OBSERVATION PREVERIES: LINEAR PREVISIONS, FIRT () 1._AT: 02._AT: SUME = 13._AT: In 24._T: SUMMARY = 3 ----------------------------------- ------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Z P> |Z | [95% conf.Intervall] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #trt | 11 1 1 | 4.25 .3801727 11.18 0.504875 4.995125 1 2 | 1.75 .7801727 4.60 0.000 1.004875 2.495125 2 1 | 4.5 .3801727 11.84 0.754875 5.245125 2 2 | 3.4.754875 6.245125 4 8.5 8.5 8.5.7.754875 4 2 2 | 10.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Marginsplot, x (ctime)Repeated measurement analysis with Stata (6)

Hang on each treatment and time

With a slight deviation toStripesCommand, we can receive the sections for each treatment group at any time.

TRT margin, dydx (ctime) in (ctime = (0 (1) 3)) vsquishConditional marginal effects Number of observed = 32 Expression: linear forecasts, fixed part, foreseen () dy/dx w.r.: Cime = 02._at: catch = 24._at: Clase 3-3 --------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Dy/dx Stor.iren.z P> |Z |Z | [95% conf.Intervall] ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | _at#TRT | 1 |--1.34 0.181 -3.901879, 735219 4 4 2 | 5.75 1,182953 4.86 0.000 3.431455 8.068545 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You will find that the 2 treatment ranges simply become increasingly pronounced, while treatment 1 rises the clues and then falls again.

(Video) Stata Video 11 - Modeling Longitudinal Data with Fixed- and Random-effect

Advantages and disadvantages of mixed models

There are advantages and disadvantages to use mixed models, but the general mixed models are more flexible and have more advantages than disadvantages.

Benefits

  • Correct correct errors correct for each effect automatically
  • Activate the imbalance or lack of observations within the subject
  • Activate unequal time intervals
  • allows various covariance structures within the subject
  • Allows time to be treated as categorically or continuously

Disadvantages

  • XtMixedReport results such as a square chi; P values are suitable for large and tense samples in small samples

Videos

1. Week 6 : TUTORIAL: ANOVA IN STATA
(Data Learner)
2. 8e: Mixed effects model for repeated measures
(Iain's Math & Stat Screencasts)
3. Stata repeating number sequences
(272analytics Videos)
4. STATA(14) ANOVA and Post Hoc Test
(junchen feng)
5. The repeated-measures ANOVA | explained with a simple example
(TileStats)
6. Short GPower Repeated Measures ANOVA example
(skaai)
Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated: 04/13/2023

Views: 5776

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.