# statistics test to compare ratio of two variables in two population R

I have two datasets from two courses. In one of the courses we applied an experiment and I would like to infer whether that experiment causes the average number of posts per students increases or not. In our data p1(number of posts in course 1)/ n1 (number of students in course 1) is much more than p2(number of posts in course 2)/ n2 (number of students in course 2). What kind of test I should apply to check my result could be general?

I could not find any question in stack overflow regarding ratio of variables.I tried chi-square and this is the result:

dfchsq <- data.frame(navgpost=c(itr1=p1/n1,itr2=p2/n2))
chisq.test(dfchsq)


this is the result: Chi-squared test for given probabilities

data: dfchsq X-squared = 3.801, df = 1, p-value = 0.05122

My questions are: Is chi-square an appropriate test in this case? If yes, how the result can be interpreted?

Regards, P

"whether that experiment causes the average number of posts per students increases or not"

Put differently, you want to assess whether the mean of 2 distributions, i.e. posts by students in the test condition (your experiment) and posts by students in the control condition are significantly different. With this formulation, you should apply the t-Test for the Significance of the Difference between the Means of Two Independent Samples (assuming that these are different classes). In R you should do the following:

First perform f-test to check if the variances of the 2 distributions are equal.

var.test(a,b)

Now perform the t-Test, the var.equal will be TRUE or FALSE based on the results on the F-test.

t.test(a,b, var.equal=TRUE, paired=FALSE)

Sharing a few good links on this problem:

http://vassarstats.net/textbook/ch11pt1.html

http://www.r-bloggers.com/two-sample-students-t-test-1/

This looks like a test between two proportions. The test name you are looking for is Z-test and in R its:

 ?prop.test