> Is this what is intended? > >> observed_data$p1ab <- persons$ability[ match(observed_data$p1, persons$name) >> ] >> observed_data$p2ab <- persons$ability[ match(observed_data$p2, persons$name) >> ]
Hello David, thank you for your answer. The code in my previous post was intended as an answer to the question in an earlier post about example-data, quote: > > Would you like me to make a complete example dataset with more records and > > noise ? > Yes. And preferably do it with R code. I should have re-stated this connection in the post. The code generates a matrix 'observed_data' which is the data the experimenter would get during the experiment. This matrix is output in the last line. All other output is only meant to document the generation-process. So the only thing visible to the experimenter before analysis is exactly that matrix 'observed_data' (usually in the form of some written documentation which is later entered into statistical software). Everything before that last line simulates those unknown parameters that the experiment is supposed to reveal. The unknown parameters are specifically - the matrix 'persons' - and the variable 'multiplyer' Both are supposed to be revealed by the analyis. p1ab and p2ab would therefore depend on the unknown parameters and could not be added to 'observed_data' before the analysis. Sorry again for omitting the back-reference. I would like to know: - how to get R to use p1 and p2 as levels of the same factor (=persons) instead of levels of two different factors. - how to get R to multiply the numerical levels of factors during the search for the solution. Factors cannot be multiplied before running lm() or some other package because before the analysis their numerical values are not known. THX, Stefan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.