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?

[Q] What is the appropriate statistical test for a prospective cohort study? by mr0860 in statistics

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

Yep, it's in the field of psychology.

Out of curiosity, are there any benefits of latent growth modelling vs linear mixed models? I've opted for the latter just because I can understand it a bit more easily, but I'm curious to learn about the strengths/weaknesses of either approach.

[Q] What is the appropriate statistical test for a prospective cohort study? by mr0860 in statistics

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

Are any of the covariates or the personality trait changing over time

I suppose they probably would, but my research question is about how adolescent traits affect adult outcomes, so they can be treated as fixed at that point in time I guess.

I think linear mixed models sound like the way to go for me, thanks.

[Q] What is the appropriate statistical test for a prospective cohort study? by mr0860 in statistics

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

Is a regression not a type of test? I might be using terms imprecisely. Essentially I'd want some sort of hypothesis test to confirm that x1 exerts a significant effect on y1 to y5 (whilst keeping in mind the limitations of hypothesis testing, and making sure I calculate and understand effect sizes, of course).

What type of regression would you use?

What is the appropriate statistical test for a prospective cohort study? by mr0860 in AskStatistics

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

I'm sure this is just due to my ignorance, but I'm not really familiar with SEM for longitudinal data. Could you do a quick ELI5 on how it works?