I'm new to R (and statistics in general) so apologies in advance for what's probably a very remedial question, but I'd appreciate any help!
I'm trying to assess if there's a statistical advantage to starting a motor race in a given lane over another.
The sample sizes I have are small and not necessarily normally distributed so I'm opting to use a chi sq test to check for a significant difference between the expected vs observed wins.
#create lanes var
lane_num <- c(1:10)
#num wins per lane
num_wins <- c(8, 7, 10, 7, 6, 3, 6, 4, 1, 0)
#create df
df <- as.data.frame(cbind(lane_num, num_wins))
#convert lanes_num factor
df$lane_num <- as.factor(df$lane_num)
#check str
str(df)
#run chisq
chi_res <- chisq.test(df$num_wins)
#check results
chi_res
#check for sig diff between lanes
chisq.post.hoc(df) #this is where i'm having issues
The result of the chisq.test gives the following results suggesting a significant difference between expected v observed;
Chi-squared test for given probabilities
data: df$num_wins
X-squared = 17.231, df = 9, p-value = 0.04522
Where I'm struggling is when it comes to running a post-hoc test between lanes to see exactly which ones are significantly more advantageous to start from.
Simply running:
chisq.post.hoc(df)
returns the following error;
Error in test(tbl[prs[, i], ], ...) :
all entries of 'x' must be nonnegative and finite
As I say, I'm new to R and stats so the documentation provided regarding chisq.post.hoc doesn't make a lot of sense to me - plus it seems the package is no longer supported so i had to download an archived version. I've tried various things but all produce errors. For example;
chisq.post.hoc(df$num_wins, control = "bonferroni")
> Error in 1:nrow(tbl) : argument of length 0
I'd really appreciate a steer on this or any advise regarding an alternative post-hoc test I could use along with how the data needs to be structured before running etc.
Thanks in advance!