Re: [R] Cannot load vegan and vcd, "object vI not found"

2019-08-19 Thread Jeff Newmiller
Try closing all instances of R except for one and then run the update.packages() function. If that doesn't work then post the output of sessionInfo(). On August 19, 2019 5:11:11 AM PDT, Camilo Bernardo Garcia Ramirez wrote: >Hi: Could you help me with the following issue?: > >I downloaded the

Re: [R] Simulate I x J contingency tables using correlation coefficient using bivariate normal distribution

2019-08-19 Thread Abby Spurdle
> Step 1. generate random values from a multivariate normal distribution > Step 2. convert the random values into probabilities > Step 3. convert the probabilities into values from the target distribution This requires a cautionary note. The method above is simple in the univariate case (where peo

Re: [R] Creating data using multiple for loops

2019-08-19 Thread Jeff Newmiller
Perhaps different people find different concepts the most challenging, but I find looking at the output of expand.grid quite informative... do try it out. The do.call function seems to be the more obscure function here, but Bert's code id <- do.call( paste0, expand.grid(0:9,1:3,1:5) ) is equiva

Re: [R] Creating data using multiple for loops

2019-08-19 Thread Bert Gunter
>From section 9.2.2 (on looping) in "An Introduction to R": "*Warning*: for() loops are used in R code much less often than in compiled languages. Code that takes a ‘whole object’ view is likely to be both clearer and faster in R." Web searching on "for loops in R" and similar will give you furth

Re: [R] Creating data using multiple for loops

2019-08-19 Thread Jim Lemon
Hi Greg, I replied because I thought the name of the "expand.grid" function can be puzzling. While "expand.grid" is a very elegant and useful function, it is much easier to see what is happening with explicit loops rather than loops buried deep inside "expand.grid". Also note Bill's comment about p

Re: [R] Simulate I x J contingency tables using correlation coefficient using bivariate normal distribution

2019-08-19 Thread Sri Priya
Dear Thierry, Thank you very much for your answer. I got some idea about generating tables from bivariate normal from your code. But still there will be an argument to choose the lambda value. So, I am thinking whether to generate count data using margial CDF? Because one may wish to test the ind

[R] Cannot load vegan and vcd, "object vI not found"

2019-08-19 Thread Camilo Bernardo Garcia Ramirez
Hi: Could you help me with the following issue?: I downloaded the packages vegan and vcd with R3.6.1. When I try to load them I got this error messages: > library(vegan) Loading required package: permute Loading required package: lattice Error: package or namespace load failed for ‘vegan’ in loa

Re: [R] Creating data using multiple for loops

2019-08-19 Thread William Dunlap via R-help
do.call(paste0,expand.grid(0:1000, 1:12, 1:30)) takes care of storing all the values, but note that paste() doesn't put leading zeroes in front of small numbers so this maps lots of ssn/month/day combos to the the same id. sprintf() can take care of that: id <- with(expand.grid(ssn=0:1000, month=

Re: [R] linear mixed model required for the U.S. FDA

2019-08-19 Thread Thierry Onkelinx via R-help
Dear Helmut, The mixed models list is more suitable for this kind of question. I'm forwarding it to that list. Please send any follow-up to that list instead of the general R help list. If I understand correctly, you'll need a different variance term for both treatments (the within subject for T

[R] linear mixed model required for the U.S. FDA

2019-08-19 Thread Helmut Schütz
Dear all, I’m struggling to set up a model required for the FDA (haha, and the Chinese agency). The closest I could get given at the end (which matches the one preferred by other regulatory agencies worldwide). The FDA is happy with R but "close" is not close /enough/. Don't hit me. I'm well

Re: [R] Simulate I x J contingency tables using correlation coefficient using bivariate normal distribution

2019-08-19 Thread Thierry Onkelinx via R-help
Dear Sripriya, Step 1. generate random values from a multivariate normal distribution Step 2. convert the random values into probabilities Step 3. convert the probabilities into values from the target distribution library(mvtnorm) n <- 1e3 correl <- 0.9 lambda <- c(10, 50) sigma <- matrix(correl,

[R] Simulate I x J contingency tables using correlation coefficient using bivariate normal distribution

2019-08-19 Thread Sri Priya
Dear R Users, I am interested in generating contingency tables from bivariate normal distribution using different correlation coefficient values. I am experimenting numerous ways of generating contingency tables, and one possible way is to generate from multinomial distribution. I wonder how to