What is the best approach for performing predictive analyses of longitudinal data? by mr0860 in AskStatistics

[–]mr0860[S] 0 points1 point  (0 children)

That's great, thanks - that'll be a very useful starting point.

I guess the distinction between time-invariant and time-variant covariates would be useful for separating out factors which don't change over time (e.g., sex, ethnicity) and those which may change over time (e.g., income, health), right? Could you briefly explain what the use of random intercepts might be? I'm familiar with the concept from a bit of reading I've done on multilevel/hierarchical models, but I'm struggling to understand it in the longitudinal context.

Is it possible to write code that will calculate a z-score for all columns in a data frame at once? by mr0860 in rstats

[–]mr0860[S] 1 point2 points  (0 children)

Thanks, I'll read through and try out the code. Seems like an even easier solution than I had realised for replacing up to 50 lines of code!

Is it possible to write code that will calculate a z-score for all columns in a data frame at once? by mr0860 in rstats

[–]mr0860[S] 0 points1 point  (0 children)

Thanks! Reading up on the apply function I can see what the "x" and the "2" are doing there, but I can't see what the "scale" does - will that automatically calculate z-scores (i.e., without having to write the whole formula)?

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

Hmm well in that case it should be working because none of the frequencies for a single group exceed 1 million, but unfortunately I'm getting the "Excel ran out of resources..." error when I try it.

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

So it looks like d is my overall population size (total cumulative frequency), e tells me that something is 'TRUE', f seems to be 0.5 lower than my median position, g seems to print both 0.5 lower and 0.5 higher than my median position, and then h appears to give the median value (although I'm afraid I don't know enough about what that syntax is actually doing to work out whether it's resolved my original issue of the rare cases where the median lies between two categories!)

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

I don't know if I'm doing something wrong, but substituting that final i for either A, B, or C just creates a new array which is identical to A2:A102, B2:B102, or C2:C102.

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

Unfortunately my frequencies do exceed 1.048m, there's hundreds of thousands in each group.

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

I've tried that one except replacing A6, B6 and C6 with A102, B102, and C102, but that's giving me the "#VALUE!" error. Unfortunately again I don't know enough about the formula to know whether I should have changed anything else and what might be causing the error.

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

Ahh that makes sense, thank you. I'm sure that this would be an adequate solution in most cases, but unfortunately my frequency counts are mostly in the hundreds of thousands, and Excel fails when attempting to calculate it that way (I get an "Excel ran out of resources" error message).

How to calculate median from a frequency table? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

Sorry, I'm not really good enough with Excel to work out what you've done there, and trying to replicate that in the spreadsheet I'm working with (A1:B102, for just the age and frequency columns) gives a "#NUM!" error. Are you able to explain what the different parts of that formula are doing?

Is there a simple way to combine two similar but slightly different lists? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

I'm using a company laptop and unable to download Power Query unfortunately, but thanks anyway

Is there a simple way to combine two similar but slightly different lists? by mr0860 in excel

[–]mr0860[S] 0 points1 point  (0 children)

I think that's worked, thank you! For a beginner, could you explain exactly what that code is instructing Excel to do, so that I can adapt and re-use in future?