January 10, 2013 Filed in: R | Statistics
Here’s a video how the modFit function from the FME package optimizes parameters for an oscillation. A Nelder-Mead-optimizer (R function optim) finds the best fitting parameters for an undampened oscillator. Minimum was found after 72 iterations, true parameter eta was -.05:
Evolution of parameters in optimization process from Felix Schönbrodt on Vimeo.
More on estimating parameters of differential equations is coming later on this blog!
Things I’ve learned:
- ffmpeg does not like pngs. They are internally converted to jpg in a very low quality and I could not find a way to improve this quality. Lesson learned: Export high quality jpgs from your R function
- Use a standard frame rate for the output file (i.e., 24, 25, or 30 fps)
- My final ffmpeg command:
ffmpeg -r 10 -i modFit%03d.jpg -r 25 -b:v 5000K modelFit.avi
- -r 10: Use 10 pictures / second as input
- -i modFit%03d.jpg: defines the names of the input files, modFit001.jpg, modFit002.jpg, …
- -r 25: Set framerate of output file to 25 fps
- -b:v 5000K: set bitrate of video to a high value
- modelFit.mp4: video name and encoding type (mp4)