Closed yaoxi-psy closed 4 years ago
Hi @yaoxi-psy . If I had to guess I would think it might be an issue with NAs or 0s in the dataframe before running create_functional_data. Did you run the pre-processing steps? You may need to interpolate pupil data across gabs to use create_functional_data effectively.
An alternative is you could try GAMs to model it rather than FDA. If you have a reproducible example I am happy to help further.
thanks a lot@samhforbes yaoxi.zip
I had run pre-processing steps, but it still didn't work. My workplace and all used codes had been uploaded, I will appreciated it if you can help me further.
This is really helpful @yaoxi-psy. I went through your data (looks great and I'm so glad everything else works for your paradigm).
The issue is 2 participants seem to have shorter trials than the others (0341 and 443). So when I trim the length to around 4000ms where each of your participants has data, the function works, but not when they are different lengths. This is due to the way the package fda works, it takes a matrix, so all trials have to be the same length for that analysis. So as I see it the options would be:
I hope that helps!
yes!!! it is really helpful and I know the reason why it didn't work now. it is very nice of you@samhforbes I trimed the length to 4000ms and the function works. However, when I go to the final step of FDA with excitement, it is unexpected that this function doesn't work(as shown in the picture). it is said "Dataframe has not been assessed using create_functional_data".
Great, I'm so glad it works. I've just checked - this works for your data. run_functional_t_test needs to be run on spline_data you made above, rather than on differences, if you do that it should work. Happy hunting!
It is my carelessness. @samhforbes
Benefiting from your kindly help, I finished my analysing in time. Thanks for your kindly help and your nice packages. Hope it better and better.
Just an another small question: I am wondering whether the outliers(as shown in the picture) are supposed to be removed by adding a new function?
All in all,thanks and best.
@yaoxi-psy I'm so glad you got it all done! Yes I'm looking at a couple of options for either thresholding or blink detection for future updates, so hopefully have more for you on that front soon!
spline_data <- create_functional_data(data = differences, + pupil = mean_pupil, + basis = 10, + order = 3) Error in [[<-.data.frame(tmp, pupil, value = c(0.09092938263732, : replacement has 4680 rows, data has 4601
What's wrong with it, please