jwdink / eyetrackingR

This package is designed to make dealing with eye-tracking data easier. It addresses tasks along the pipeline from raw data to analysis and visualization.
http://eyetrackingr.com
Other
82 stars 20 forks source link

Analyse time clusters #63

Open MonicaBarbir opened 6 years ago

MonicaBarbir commented 6 years ago

Hello Eyetracking R,

I am having some problems analysing time clusters. I get the following error in the script that had worked a couple days ago: Error in .subset2(x, i, exact = exact) : recursive indexing failed at level 2

I have recently updated Eyetracking R, and other necessary packages such as Dplyr. Since having the problem, I've gone about updating every package just in case, but to no avail.

I had had a similar problem before, but it had worked out when I downgraded Dplyr (which I believe cannot do now, because the new version of Eyetracking R requires the new version of Dplyr).

Any ideas what it may be caused by?

Thank you, Monica

MonicaBarbir commented 6 years ago

Re-hello EyetrackingR,

Update that might help with figuring out the source of the problem: I just ran analyse time clusters on the data set provided with eyetrackingR and I got the following error - Error in *tmp*[[jj]] : subscript out of bounds

Thanks again, Monica

jwdink commented 6 years ago

Hey @MonicaBarbir ,

Can you provide the code for a reproducible example?

Thanks!

respatte commented 6 years ago

Hi everyone,

I'm having the same issue so I'm just going to add it here rather than open a new one. There are a couple issues with analyze_time_clusters:

Run analysis with within_subj = F

LT.time_cluster_tail.analysis <- analyze_time_clusters(LT.time_cluster_tail, formula = ArcSin ~ Condition + (1 | Participant) + (1 | Stimulus), within_subj = F, parallel = T)

Error in get_resampled_sum_stat_btwn(data, rows_of_participants, attrs, :

task 1 failed - "subscript out of bounds"



I'm not totally sure I understand the use of `within_subj` however, so that might be the issue. In my experiment, each participant is assigned to one of two conditions, and so `Condition` should be a between-subject factor, hence why I want to use `within_subj = F`; am I wrong?

If you want my data to run the code on it, you can find it on [my experiment's GitHub repository](https://github.com/respatte/SalienceDiagnosticityEmpirical). You need to open the `stats/InfantsAnalysis.R` file, run the blocks `LIBRARY IMPORTS` and `GATHER DATA`, then in the block `LOOKING TIME ANALYSIS: TIME COURSE` you can run the `DATA PREPARATION` lines and finally play with the code starting line 160.
arielleborovsky commented 5 years ago

I also encountered this issue and found that the problem had to do with specifying the make_time_sequence_data function. In my case, both "condition" and "participant" were wrongly included in the "summarize_by" argument. Moving "condition" to the "predictor_columns" argument cleared up the issue for me. Hope this helps you too!

Example in code:

WRONG:
timecourse <- make_time_sequence_data(df, time_bin_size = 50, aois = c("AOI1", "AOI2", "AOI3", "AOI4"), predictor_columns = c("Sex"), summarize_by = c("Participant", "Condition"))

CORRECT: timecourse <- make_time_sequence_data(df, time_bin_size = 50, aois = c("AOI1", "AOI2", "AOI3", "AOI4"), predictor_columns = c("Sex", "Condition"), summarize_by = c("Participant"))