# How to test difference from 50%

I'm using R studio to analyse my data: I have a dataset of zebrafish with independent variables: treatment and sex as in this attached graph. I'm testing the percentage of 600s that the fish spend in the half of the tank containing conspecifics.

I have performed a 2-way anova to test the difference between the variables and the interaction, but I cant work out how to test each variable against the null hypothesis that the fish spend 50% of their time with the conspecifics.

I performed my anova using this script:

sp1 <- lm(percent ~ treatment + sex + treatment*sex, social.prefss)
anova(sp1)


I'm sorry if I've explained this poorly, I'm only an undergrad and havent got a great grasp of statistics!

EDIT: I've just tried to do a one sample t-test by using this script:

per<-social.prefss$percent treat<-social.prefss$treatment
sex<-social.prefss$sex x<-social.prefss$percent
t.test(x,mu=50


and this is what came out:

One Sample t-test

data: x

t = 9.2808, df = 39, p-value = 2.028e-11

alternative hypothesis: true mean is not equal to 50

95 percent confidence interval:

65.36873 73.93460

sample estimates:

mean of x

69.65167

• I've flagged this for migration to Stats because it doesn't appear to be about any specific programming language.
– underscore_d
Apr 21, 2016 at 13:21
• sorry, i forgot to say I'm using R
Apr 21, 2016 at 13:25
• Please edit to add this tag. I'm still not sure this is a programming Q, possibly more just general stats. Did you have some problem that is specific to R?
– underscore_d
Apr 21, 2016 at 13:27
• I think its both really - I dont know whether its a particular statistical test that I'm looking for, or just a way to add specific parameters to the test I've done?
Apr 21, 2016 at 13:29
• Sadly I've forgotten most of what I ever learned about stats... I think this is less specific to any particular language, and more about the general theory. So, I suspect you'd get a more useful response on the Stats subsite, but hey, I might be wrong.
– underscore_d
Apr 21, 2016 at 13:40