t-test/regression - how to account for random effects? I need your help on how best to test the following hypotheses in R. Each observation in my data has RaterID and RaterGender, along with their ratings on 5-point scale for four different attributes (P1, P2, P3, P4) of product (ProductID).There are multiple observations for each rater and same product may have ratings from multiple observers.
How do I statistically model in R to test the following hypothesis: 
H1: Men are more likely have higher ratings on P1 than P2.
H2: Women are more likely to have higher ratings on P4 than P3.
How should I control for the random effects of raters and products? 
 A: Based on your description, you could start from a model that contains as fixed effects the sex and the attribute, where sex is a factor with levels male and female, and attribute a factor with levels P1-P4, and random effects for ProductID and RaterID, e.g., something like
y ~ sex * attribute + (1 | ProductID) + (1 | RaterID)

By including the interaction, you could test your specific hypothesis of interest by using suitable contrasts.
An additional important point is what type of mixed model you will use. If I understood correctly, you have an ordinal outcome (i.e., 5-point scale). There are not that many options with regard to software for proportional odds models. However, you could use the continuation ratio model instead that requires a couple of extra data management steps, and fitting the model with a mixed effects logistic regression.
A: You should probably be using the Mann-Whitney-Wilcoxon Test.  In R if your data is in data frame X with X\$gender being the gender data and X\$difference being the difference between the rating of $P_i$ versus $P_j$ then your code would be 

wilcox.test(difference~gender, data=X)

the null would be that there is no gender-based difference.
You would control for product effects by solving it for each product.  However, as you are doing multiple comparisons, you will need to add the FSA library to get the Holm-Bonferroni correction.
Run each test and capture the p-values into some variable such as calling it pvalues.  Then you would run 

final_values$Holm = p.adjust(pvalues, method = "holm")

Unless you know what the random effects are, you cannot control for them. There isn't a simple answer as to adding a variable for nonparametric anova that I have found.  The Friedman test may be appropriate, but you would have to research it appropriateness for your data. 
