Hi I've been trying to create an animated graph using Robert Grant resources from here
First youtube video available here:
http://www.robertgrantstats.co.uk/an...aphs/line.html
Do file available here;
http://www.robertgrantstats.co.uk/an...illing_line.do
I've tried working around it, but using P Lambert dataset (as R Grant doesn't provide a dataset - so had to make do with stuff available)
The problem is nothing happens at the end... I just end up with - end do file-
I'm not sure if it's because I get the following message - but it doesn't appear as an error in red
zsh:1: command not found: del

Here's my code:
In addition my graphs, look like this (see below - greyish rough sketched area )
rather than the beautiful smoothly shaded blue parts and red line in the curves provided by https://pclambert.net/statasvg/stpm2..._age_time5.png
Of course I never get to view the video.....so not sure if with the ffmpeg, this issue is solved...
Also, do you think its impossible to overlay another plot for hormone = 1 as well... not sure if stata can cope....
It would have:
[CODE
predict t5_age2, surv at(hormon 1 pr_1 3.43) ci timevar(t5)
[/CODE}

First youtube video available here:
http://www.robertgrantstats.co.uk/an...aphs/line.html
Do file available here;
http://www.robertgrantstats.co.uk/an...illing_line.do
I've tried working around it, but using P Lambert dataset (as R Grant doesn't provide a dataset - so had to make do with stuff available)
The problem is nothing happens at the end... I just end up with - end do file-
I'm not sure if it's because I get the following message - but it doesn't appear as an error in red
zsh:1: command not found: del
Here's my code:
Code:
stset rf, f(rfi==1) scale(12) exit(time 60) use https://www.pclambert.net/data/rott2b //Use here Predict survival as a function of age gen t5=5 predict t5_age, surv at(hormon 0 pr_1 3.43) ci timevar(t5) //Robert grant code begins from here local frames 100 // in this simple example there is one frame per time point #delimit ; local opts "legend(off) graphregion(color(white)) ylabel(0(0.5)1.0) yscale(range(0 1.0)) xlabel(0(20)100) xscale(range(0 100))"; #delimit cr twoway (rarea t5_age_uci t5_age_lci age if age<1, lcolor(gs14) fcolor(gs14)) /// (line t5_age age if age<1), /// `opts' title("Age = 0") name(line0, replace) graph export "`picpath'line0.png", replace // loop over frames forvalues i=1/`frames' { twoway (rarea t5_age_uci t5_age_lci age if age<=`i', lcolor(gs14) fcolor(gs14)) /// (line t5_age age if age<=`i'), /// `opts' title("Age = `i'") name(line`i', replace) graph export "`picpath'line`i'.png", replace graph drop line`i' // to stop the Graph Window being cluttered } // make the video !del "`vidpath'filling_line.mpg" // overwrite existing file sleep 500 // make sure the file has been deleted before proceeding winexec "/Users/martinaib/Downloads/ffmpeg-6.0.tar.xz" /// or wherever you have saved it -report -i "`picpath'line%d.png" -b:v 2048k /// "`vidpath'filling_line.mpg"
rather than the beautiful smoothly shaded blue parts and red line in the curves provided by https://pclambert.net/statasvg/stpm2..._age_time5.png
Of course I never get to view the video.....so not sure if with the ffmpeg, this issue is solved...
Also, do you think its impossible to overlay another plot for hormone = 1 as well... not sure if stata can cope....
It would have:
[CODE
predict t5_age2, surv at(hormon 1 pr_1 3.43) ci timevar(t5)
[/CODE}
Comment