Publications by nzcoops
2011 Perth City to Surf Stats
Like every year, August sees the thousands taking part in the Perth City to Surf, and with that comes the chance for some stats. Why? Curiosity more than anything, and to convince myself that my time in the 12km run of 1 hour 9 mins and 36 seconds wasn’t so bad given I came down with the dreaded man flu just 36 hours prior to the race starting....
4448 sym 26 img 14 tbl
Children height and blood pressure z-scores
Following on from some of my earlier posts, this is purely about, hopefully, saving some other people some time in putting this together. Height z-scores are required to then calculate the blood pressure z-scores. The CDC (Center for Disease Control and Prevention) have (growth) charts available for using an LMS Box Cox transformation to calculat...
2033 sym 4 img
Latent class mixed models – with graphics
Foreword Apologies that the output isn’t showing well as far as spacing and alignment is concerned. Am working on fixing that! Background Generally when we have a set of data, we have known groupings. Be that three different treatment groups, two sex groups, 4 ethnicity groups etc. There is also the possibility of unobserved groupings within yo...
14111 sym R (864 sym/2 pcs) 16 img
Kaplan-Meier Survival Plot – with at risk table
Credit for the bulk of this code is to Abhijit Dasgupta and the commenters on the original post here from earlier this year. I have made a few changes to the functionality of this which I think warrant sharing. A brief intro, this function will use the output from a survival analysis fitted in R with ‘survfit’ from the ‘survival’ library...
2774 sym R (629 sym/5 pcs) 8 img
Kaplan-Meier Survival plot – with at risk table, by sub groups
This is a follow on from the previous post, with updated code. There was an argument ‘groups’ in the ggplot(…) line of the code that was working but is now no longer working with the updated version of R/ggplot2 (I don’t know the full ins and outs of this sorry). So code is fixed and available below. Most up-to-date code available here: ...
846 sym 4 img
LME summary data – results table
UPDATE: Based on the comment from ‘linuxizer’, I’ve updated this to stay inline with the S3 classes, something I didn’t have my head around at the time, still don’t know it inside out. Brief post. One thing I do often in my analysis is use things like ‘summary(mod)$coefficients’ and variance derivatives of that to pull the results f...
1378 sym R (778 sym/1 pcs) 4 img
Petrol prices adjusted for inflation
Petrol prices adjusted for inflation (Perth, Western Australia) The thought for this sprung to mind when I saw petrol drop below $1.20 per litre the other day, and it made me think, I remember paying that when I got to Australia 4.5 years ago. Fuel prices are listed online here, so I went to the site for a nosey at their archiving and they have a...
2188 sym R (1539 sym/2 pcs) 6 img
(Manually) making letters with geom_path() – fun example
Disclaimer, maybe the title should be ‘lame example’. Nothing overly exciting here. Just posting cause it took a little faffing about and someone else might like the idea. At my work (research institute) we (the social club committee) were organising an ‘Olympics event’ with a bunch of task for teams of 4, with a loose research theme. I t...
1443 sym 6 img
Simple plot with text boxes
Was doing a little presentation to our research group and had to explain the difficulties of ‘collapsing’ longitudinal data into a single measure when the Y var is quite variable. For the particular Y var of interest, it represents burden of disease, so a high Y var for a long time is indicative of high risk, compared to a low value for a sim...
1290 sym R (801 sym/2 pcs) 6 img
Popularity indicator, with images (NFL)
It’s Friday night, there’s nothing good on TV, mmm conditions are perfect for shaggin about in R. So I’m an NFL fan, and (shameless plug) avid fan of this NFL podcast. They run their own pickem league which unless users opt out shows their tips in a table. You can eyeball it and get a feel for who picked what, but naturally I wasn’t too f...
2028 sym R (1978 sym/2 pcs) 6 img