Hello all,
I am trying to run a repeated measures ANOVA using a linear model.
I have two within-subject variables: Type (velocity) and Target (distance).
Target has five levels: 70.1075, 101.71, 149.1155, 220.2225 and 326.8835m.
Type has 6 levels: being beaconed-0, beaconed-0.5, beaconed-2, probe-0, probe-0.5, probe-2
I first uploaded my data in a form where each column represents a different factor level, so in this case each column represents a different combination of gain and target distance.
I then converted this dataframe to a matrix: Recenterrormatrix <- as.data.frame(Recenterrormatrix).
The data from Recenterrormatrix is below:
structure(list(`70.1075-Beaconed0` = c(1.75823715597722, 2.15334234951937,
2.04554861065665, 1.21858551669378, 1.42460119527448, 2.12796976678432,
1.91639306022947, 1.76243363984623, 1.62383379271783, 1.42383096464862,
1.78791876984212, 1.52239744411223, 2.02488635415117, 1.53992704966997,
2.02154756326093), `70.1075-Beaconed0.5` = c(1.90936471130232,
2.05473892903946, 2.02429874218263, 1.97424767880133, 1.46589081539103,
2.1153876684533, 1.62924053973028, 1.10644817443588, 1.55776559885943,
1.63810311164787, 1.35346120402465, 1.73533020126134, 1.91601043156591,
1.50376623726006, 1.93735940974538), `70.1075-Beaconed2` = c(1.74442324757176,
1.88233116741244, 1.94241834551317, 1.47946589200769, 2.63246421414561,
2.61090767691312, 1.57260793918338, 1.55776559885943, 1.18589029677517,
0.941490532895897, 1.887372633431, 1.32596032208019, 2.23919790881364,
2.1932611778793, 2.14387068183553), `70.1075-Probe0` = c(2.68878582892075,
2.37622581314541, 2.26921443485221, 2.79624421183813, 1.7772886027996,
2.04487597649252, 2.61196505442194, 2.134781636713, 1.84650014788552,
3.07786510309251, 1.65448775698781, 2.51380180144149, 1.41764766877789,
3.45862946175578, 2.43122453953814), `70.1075-Probe0.5` = c(1.94864925142981,
3.41721507735536, 2.22315219934613, 2.70370745166807, 3.24310784359663,
3.10046159004753, 2.17618251559173, 2.34028542017687, 2.46594466904947,
1.95961579611143, 2.15364415221235, 2.23381362556683, 1.7298486038883,
3.46411584120833, 2.97606003775647), `70.1075-Probe2` = c(2.81527697421775,
3.56245985548332, 2.49974599998464, 2.89708528278297, 2.29841641612183,
2.81605521698494, 3.10861443061066, 2.34276688262688, 2.57287173851664,
2.17101748516705, 2.25530478841274, 2.58860578611916, 3.19548436541083,
3.87290788669958, 3.09407421655267), `101.71-Beaconed0` = c(1.68335729537742,
2.20989946603581, 1.78808606386175, 1.68891430593588, 1.48255863108995,
2.24760078466129, 1.85679786540728, 1.41556185880046, 1.12768553615382,
1.59196616652206, 1.51600596764155, 0.937739063080025, 1.880990602956,
1.97024032663607, 1.87349305425473), `101.71-Beaconed0.5` = c(1.77220281167884,
2.03360700533604, 2.13683742732112, 1.85885721276055, 1.22946509708687,
2.14260411663748, 1.07069280866998, 0.827153460407679, 1.14377684062248,
1.73405973242868, 1.70743538731534, 1.2749157731365, 1.97374763712077,
1.84498423046535, 1.36894472278478), `101.71-Beaconed2` = c(1.60991779727095,
1.85313674890296, 1.61724733932558, 1.44748352943231, 2.29974105254231,
2.03161591219723, 2.21750639263573, 2.90464715559222, 1.48428276944809,
1.29406941707737, 1.7409923521744, 3.12710258271889, 2.18831836786522,
1.80068617404458, 1.91542148605579), `101.71-Probe0` = c(2.57401582485978,
3.53259984305323, 2.17939999242367, 3.09677146572826, 2.25291153875047,
2.2932012016837, 2.18914760176789, 2.56634837837524, 2.93531325559963,
3.55776798824622, 1.98507591564411, 2.97179812325836, 2.31973715181161,
3.36248427298925, 2.95978380077777), `101.71-Probe-.5` = c(2.42745407503992,
3.16615835893488, 3.38844305662239, 3.18880417114081, 2.41862438699402,
2.75219467008639, 2.72083479546163, 3.38641533015725, 2.62889154698259,
3.50984847741805, 1.46925588183424, 1.5391441952141, 3.80730228505766,
4.05468855434181, 3.22632798839324), `101.71-Probe-2` = c(2.69423521206848,
2.76261414109258, 3.06202550428782, 3.06360585219969, 2.61400322312241,
3.52550133208654, 2.80949907625988, 3.19757864127895, 4.10534055080508,
4.03776010128673, 2.93492013415723, 3.91938781849117, 3.32806022017051,
4.03318875768643, 3.15958431406428), `149.1155-Beaconed0` = c(1.73888597962099,
4.46300044719627, 1.98992703447209, 1.02725949188953, 1.35933417953711,
1.95571902718882, 1.78995784728143, 1.469117814319, 1.90342009743436,
1.71386999723335, 1.67477611374224, 1.5020753941056, 1.99991120272303,
1.73913195182737, 1.82274120683678), `149.1155-Beaconed0.5` = c(1.7645595493014,
1.47677471424827, 1.88891642753519, 1.50047090118216, 1.95194902116456,
2.27566600364278, 1.45484046615491, 1.06346858653253, 1.65856135439365,
1.69733889360856, 1.50389960319415, 1.64495948450118, 1.70710893960755,
1.9391156903379, 1.47471724146979), `149.1155-Beaconed2` = c(1.91170313201062,
1.96618885348498, 2.40994959932057, 1.49707516046325, 1.74878237637291,
2.01966499764376, 2.08728569570289, 1.29582245795581, 1.83418018511201,
1.44418583953567, 1.79876818403861, 1.29214850322966, 2.40342540792012,
1.79654798595985, 1.9617834982116), `149.1155-Probe0` = c(2.09144422047099,
4.26034475840651, 2.06155757258128, 3.5863205657862, 2.50092762584218,
2.66409831357303, 3.77574040312318, 3.09953357426773, 3.07056141417464,
4.46740412551487, 1.58338137011432, 3.05647924082709, 2.74779641718028,
3.17985221228933, 3.10266555177213), `149.1155-Probe0.5` = c(3.20698136542113,
3.57615858404982, 2.7865902418756, 3.51199906726936, 3.33108245233226,
3.32500004882659, 3.21522115468938, 2.70205895604925, 2.76826689659076,
4.79469242221875, 0.849979974586734, 2.98539149148467, 2.7653878581364,
3.47764594582538, 3.11432387112496), `149.1155-Probe2` = c(3.51226160023666,
4.11549595273072, 3.4017638878339, 3.43996927616269, 3.83004801543231,
3.26160000907798, 3.96514283069209, 3.79389240937965, 3.56743895684169,
3.55693537247309, 1.78532212726405, 2.81677305775084, 3.22225411202475,
3.55567943515053, 4.32044108256178), `220.2225-Beaconed0` = c(1.65429654874233,
1.77667967179296, 2.01450294052092, 1.56824084758376, 1.50354392117013,
2.27395411019489, 1.41049904981671, 1.78231501040006, 3.33888748640317,
1.43011984065992, 1.61231377317956, 1.90133110565735, 2.03114375627208,
1.50917549049571, 1.79760899401695), `220.2225-Beaconed0.5` = c(1.54879579046454,
2.02350590934953, 1.86544354202533, 1.83430797247401, 1.52853149854038,
1.99950507836217, 1.73652860822864, 0.828726474801768, 1.43893424844407,
1.64738858866257, 1.66278908793109, 1.5145556410639, 1.81025405186422,
1.79262576055601, 1.74498227766913), `220.2225-Beaconed2` = c(1.80223771351568,
1.59675785927673, 1.68227936860923, 1.11021142451146, 1.91049020382405,
2.49852187387004, 1.70532974122967, 1.40270890238799, 1.81188884052322,
1.28276550029103, 1.91155529268214, 1.1346870328051, 1.95758459390095,
1.93018718859008, 1.84785620857993), `220.2225-Probe0` = c(3.82406135889358,
3.30011658382239, 2.91668906621354, 3.209164825373, 2.71149758537212,
3.22499307627536, 4.21342749338886, 3.05908258905475, 2.9702503495393,
4.03860631593724, 2.23020792981823, 3.20572574025869, 3.96135016824513,
2.64106958937618, 2.17693116295709), `220.2225-Probe0.5` = c(3.80188665918028,
4.00491207489055, 2.96800129981568, 2.00541818133105, 3.85121511681938,
2.8865087505262, 3.68747847319831, 3.9491453647299, 3.02626147858881,
3.70500375603092, 2.13844131473243, 2.26646038227541, 3.16211074542684,
2.68213050261646, 3.79014911361822), `220.2225-Probe2` = c(3.3695209388016,
4.15613242877559, 2.88579463215305, 3.21967550503877, 3.67705481784727,
3.39892814221811, 4.09303704112216, 3.1549131379063, 4.4436977675301,
4.40203267265326, 1.70641942206104, 3.66658271911533, 3.81877988777808,
2.66004972504703, 3.98711934612758), `326.8835-Beaconed0` = c(1.79731069926638,
1.9841688611724, 2.05427756801629, 0.368801123736573, 1.3816335162377,
1.9471094296308, 1.9586007107289, 1.10140837597011, 1.72058564977353,
1.27804077567964, 1.7367751608953, 1.44583604382821, 2.01663485338702,
1.44936305258687, 1.83184519276734), `326.8835-Beaconed0.5` = c(1.66680074982258,
1.86705245326349, 2.00466411472201, 1.7938572673102, 1.41137714148735,
2.14546333722183, 1.45838243751414, 1.3828383961465, 1.77535904786027,
0.955665279348177, 1.54905076241901, 1.31194789899123, 2.02215664925357,
1.70201709372719, 1.4309808787423), `326.8835-Beaconed2` = c(1.80782964940555,
1.92094392760888, 1.9531694507369, 0.963174317773006, 1.65360789617857,
2.06132848625291, 1.80088437700506, 1.45801018866149, 1.76431975346927,
2.61720603380148, 1.86283905090901, 1.351599391323, 1.99224832997746,
1.73515384374893, 2.05890714670699), `326.8835-Probe0` = c(3.430089294916,
3.84944096912533, 2.61776072975475, 4.48139221657144, 3.71499057234443,
2.18647815190606, 5.06123968457733, 3.29804184066739, 3.15033142423173,
4.63075215907771, 2.08009133052133, 3.6051934510256, 3.1178879574568,
3.50091601177257, 3.26260175887181), `326.8835-Probe0.5` = c(3.36260207290277,
4.17597063110205, 3.55419882994717, 3.7890188634866, 4.0410809068951,
3.07282293591855, 4.00764586361622, 3.85734715453599, 3.58125526717332,
4.14325852825158, 2.77365065818616, 4.69795672955407, 3.94488508370516,
4.10478982008364, 4.06888315418423), `326.8835-Probe2` = c(4.19517884994741,
4.48054756359319, 3.65416377802544, 3.96160523678191, 4.71358951869151,
4.35891920252086, 4.61568867224209, 2.9821605935239, 3.39648630193204,
3.8473138030587, 1.70055750580158, 3.66480702417054, 4.08500777644499,
4.32534252010096, 3.79850486217512)), class = "data.frame", row.names = c(NA,
-15L))
I then ran a linear model on this dataset: m1m1 <- lm(Recenterrormatrix ~ 1)
I then entered this model into the Anova formula (from the Car package):
m1m1.aov <- Anova(m1m1, idata = idata,idesign = ~rdistance*rcondition, type="III")
To get idata:
idata <- data.frame(rdistance, rcondition)
rdistance<-(rep(c("70.7015","101.7100","149.1155","220.2225","326.8835"),c(6)))
rcondition <- factor(rep(c("Beaconed-0","Beaconed-0.5","Beaconed-2","Probe-0","Probe-0.5","Probe-2"),c(5,5,5,5,5,5)))
I did this in order to produce the sphericity correction, but the output is giving me this error:
Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
Sum Sq num Df Error SS den Df F value
(Intercept) 2693.29 1 23.481 14 1605.7811
rdistance 4.36 4 12.640 56 4.8237
rcondition 41.37 5 18.542 70 31.2376
rdistance:rcondition 217.83 20 73.592 280 41.4400
Pr(>F)
(Intercept) 7.577e-16 ***
rdistance 0.002053 **
rcondition < 2.2e-16 ***
rdistance:rcondition < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Warning message:
In summary.Anova.mlm(m1m1.aov, multivariate = FALSE) :
Singular error SSP matrix:
non-sphericity test and corrections not available
Does anybody know how to correct this issue?