Re: [R] simulation of PowerGARCH,Threshold GARCH,and GJR GARCH

2019-03-25 Thread Eric Berger
Doing a web search on R CRAN GJR GARCH brought up the rugarch package. The models you mentioned are discussed in the documentation to that package https://cran.r-project.org/web/packages/rugarch/vignettes/Introduction_to_the_rugarch_package.pdf On Mon, Mar 25, 2019 at 2:06 PM Amon kiregu wrot

[R] simulation of PowerGARCH,Threshold GARCH,and GJR GARCH

2019-03-25 Thread Amon kiregu
what is the r code for simulating PowerGARCH,Threshold GARCH,and GJR GARCH in order to capture heteroscedasticity,volatility clustering,etc,,so that i can have simulation of mean part and simulation on innovation part. thanks [[alternative HTML version deleted]] _

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread ruipbarradas
Hello, Right. Missed that one. Rui Barradas Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original De: Eric Berger Data: 30/01/2018 10:12 (GMT+00:00) Para: Rui Barradas Cc: Daniel Nordlund , smart hendsome , r-help@r-project.org Assunto: Re: [R] Simulation

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Eric Berger
Or a shorter version of Rui's approach: set.seed(2511)# Make the results reproducible fun <- function(n){ f <- function(){ c(mean(runif(5,1,10)),mean(runif(5,10,20))) } replicate(n, f()) } fun(10) On Tue, Jan 30, 2018 at 12:03 PM, Rui Barradas wrote: > Hello, > > Another way would

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Rui Barradas
Hello, Another way would be to use ?replicate and ?colMeans. set.seed(2511)# Make the results reproducible fun <- function(n){ f <- function(){ a <- runif(5, 1, 10) b <- runif(5, 10, 20) colMeans(cbind(a, b)) } replicate(n, f()) } fun(10) Hope this hel

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Daniel Nordlund
On 1/29/2018 9:03 PM, smart hendsome via R-help wrote: Hello everyone, I have a question regarding simulating based on runif.  Let say I have generated matrix A and B based on runif. Then I find mean for each matrix A and matrix B.  I want this process to be done let say 10 times. Anyone can he

[R] Simulation based on runif to get mean

2018-01-29 Thread smart hendsome via R-help
Hello everyone, I have a question regarding simulating based on runif.  Let say I have generated matrix A and B based on runif. Then I find mean for each matrix A and matrix B.  I want this process to be done let say 10 times. Anyone can help me.  Actually I want make the function that I can pla

Re: [R] R simulation help pls

2016-05-11 Thread Michael Friendly
On 4/06/16 11:54 AM, tan sj wrote: Hi, i am student from malaysia, i am new in r programming field, now i am trying to conduct a robustness study on 2 sample test under several combination of factors such as sample sizes ,standard deviation ratio and also distribution.. but now i am stuckin

Re: [R] simulation in R

2016-04-22 Thread David L Carlson
y College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kristi Glover Sent: Wednesday, April 20, 2016 1:06 AM To: R-help Subject: [R] simulation in R I realized that there was a typo error. I mean "Monte Ca

[R] R simulation help pls

2016-04-06 Thread tan sj
Hi, i am student from malaysia, i am new in r programming field, now i am trying to conduct a robustness study on 2 sample test under several combination of factors such as sample sizes ,standard deviation ratio and also distribution.. but now i am stucking in how to use for loop or apply fun

Re: [R] simulation in vector autoregressive model (VAR)

2015-09-04 Thread David Winsemius
Before you post on Rhelp you should first read the Posting Guide. It tells you that requests for statistical advice might be answered but are not really on-topic. Furthermore requests for tutorials or extended worked examples should probably be accompanied by evidence of searching using Google o

[R] simulation in vector autoregressive model (VAR)

2015-09-04 Thread Aziz Mensah via R-help
I have a data from 4 variables ( STOCK, CPI, EXC, and CCI) from 1980 to 2012. I want to do a forecast using VAR(12) model with a simulation of 100,000 for 5 years. And also estimate the RMSE, MAPE, and Theil Inequality. Can anyone help me with this problem in R? Thanks so much.  [[alter

[R] Simulation of strongly balanced panel data

2015-07-13 Thread deva d
Dear all, I have a strongly balanced panel dataset of 46 entities x11 years. Observed vars are not normally distributed How should I simulate the ov ? I do not know the distribution Can somebody pl help -- ** *Deva* [[alternative HTML version deleted]]

[R] Simulation of panel data

2015-07-13 Thread deva d
Dear all, I have a strongly balanced panel dataset of 46 entities x11 years. Observed vars are not normally distributed How should I simulate the ov ? I do not know the distribution Can somebody pl help --T&R ... Deva, [[alternative HTML version deleted]]

Re: [R] simulation data in SEM

2014-09-14 Thread PO SU
PLZ mke sure the package installed which contains "mvrnorm" function. -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-14 09:56:34, "thanoon younis" wrote: >Dear R members >I want to simulate data depending on SEM and when i applied the code below >i found

Re: [R] simulation data in SEM

2014-09-14 Thread David Winsemius
Adding back the list address: On Sep 14, 2014, at 9:53 AM, thanoon younis wrote: > thank you for your help but i still have error after putting semicolon > "Error: unexpected symbol in: > "Ro<-matrix(data=c(7.0,2.1,2.1,7.0), ncol=2) > yo<-matrix(data=NA,nrow=N,ncol=P) p"" The error message sho

Re: [R] simulation data in SEM

2014-09-14 Thread David Winsemius
On Sep 14, 2014, at 8:48 AM, Don McKenzie wrote: cc’ing to list, as requested in the posting guide, so that others may be able to help you. On Sep 14, 2014, at 8:45 AM, thanoon younis > wrote: Thank you very much for your reply the output is #Do simulation for 100 replications N<-1000;

Re: [R] simulation data in SEM

2014-09-14 Thread Don McKenzie
cc�ing to list, as requested in the posting guide, so that others may be able to help you. On Sep 14, 2014, at 8:45 AM, thanoon younis wrote: > Thank you very much for your reply > > the output is > > > #Do simulation for 100 replications > > N<-1000; P<-10 > > > > phi<-matrix(data=c(1.0,0.3

Re: [R] simulation data in SEM

2014-09-14 Thread Don McKenzie
What errors? What is your output? What output did you expect? On Sep 14, 2014, at 6:56 AM, thanoon younis wrote: > Dear R members > I want to simulate data depending on SEM and when i applied the code below > i found some errors and i still cannot run it. > many thanks in advance > > > Thano

[R] simulation data in SEM

2014-09-14 Thread thanoon younis
Dear R members I want to simulate data depending on SEM and when i applied the code below i found some errors and i still cannot run it. many thanks in advance Thanoon #Do simulation for 100 replications N<-1000; P<-10 phi<-matrix(data=c(1.0,0.3,0.3,1.0),ncol=2) #The covariance matrix of xi Ro<

[R] simulation data with mixed variables

2014-09-01 Thread thanoon younis
dear all members i am trying to simulate data with mixed ordered categorical and dichotomous variables with 200 observation and 10 var. 5 ordered categorical and 5 dichotomous and i want to put a high correlation between variables so i must find correlation between dichotomous and the correlation

[R] simulation data with dichotomous variables

2014-08-23 Thread thanoon younis
dear all members i have a problem with the code below, my problem in this code i want to put a high correlation between variables in group R1 and also put a high correlation between variables in group R2. after checking the correlation between variables in R1 also between variables in R2 i didn't f

Re: [R] simulation data with dichotomous varuables

2014-08-10 Thread William Revelle
Dear Thanoon, You might look at the various item simulation functions in the psych package. In particular, for your problem: R1 <- sim.irt(10,1000,a=3,low = -2, high=2) R2 <- sim.irt(10,1000,a=3,low = -2, high=2) R12 <- data.frame(R1$items,R2$items) #this gives you 20 items, grouped with high c

[R] simulation data with dichotomous varuables

2014-08-04 Thread thanoon younis
Dear R-users i need your help to solve my problem in the code below, i want to simulate two different samples R1 and R2 and each sample has 10 variables and 1000 observations so i want to simulate a data with high correlation between var. in R1 and also in R2 and no correlation between R1 and R2 a

Re: [R] simulation dichotomous data

2014-08-01 Thread Charles Determan Jr
Please remember the 'reply all' for the r-help page. First Question: How can i use Pearson correlation with dichotomous data? i want to use a correlation between dichotomous variables like spearman correlation in ordered categorical variables? cor(variable1, variable2, *method = "pearson"*) Seco

Re: [R] simulation dichotomous data

2014-07-31 Thread Charles Determan Jr
Thanoon, You should still send the question to the R help list even when I helped you with the code you are currently using. I will not always know the best way or even how to proceed with some questions. As for to your question with the code below. Firstly, there is no 'phi' method for cor in

Re: [R] simulation data

2014-04-10 Thread Charles Determan Jr
Thanoon, My reply to your previous post should be more than enough for you to accomplish your goal. Please look over that script again: ords <- seq(4) p <- 10 N <- 1000 percent_change <- 0.9 R <- as.data.frame(replicate(p, sample(ords, N, replace = T))) or alternatively as Mr. Barradas suggest

Re: [R] simulation data

2014-04-10 Thread Rui Barradas
Hello, At an R prompt type ?rbinom ?replicate Hope this helps, Rui Barradas Em 10-04-2014 02:28, thanoon younis escreveu: hi i want to simulate multivariate dichotomous data matrix with categories (0,1) and n=1000 and p=10. thanks alot in advance [[alternative HTML version deleted

Re: [R] simulation data

2014-04-09 Thread Rolf Turner
On 10/04/14 09:28, thanoon younis wrote: hi i want to simulate multivariate dichotomous data matrix with categories (0,1) and n=1000 and p=10. Nobody's stopping you! :-) cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] simulation data

2014-04-09 Thread thanoon younis
hi i want to simulate multivariate dichotomous data matrix with categories (0,1) and n=1000 and p=10. thanks alot in advance [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] simulation data

2014-04-05 Thread Charles Determan Jr
Thanoon, Firstly, please remember to reply to the R help list as well so that other may benefit from your questions as well. Regarding your second request, I have written the following as a very naive way of inducing correlations. Hopefully this makes it perfectly clear what you change for diffe

Re: [R] simulation data

2014-04-04 Thread Charles Determan Jr
Hi Thanoon, How about this? # replicate p=10 times random sampling n=1000 from a vector containing your ordinal categories (1,2,3,4) R <- replicate(10, sample(as.vector(seq(4)), 1000, replace = T)) Cheers, Charles On Fri, Apr 4, 2014 at 7:10 AM, thanoon younis wrote: > dear sir > i want to si

[R] simulation data

2014-04-04 Thread thanoon younis
dear sir i want to simulate multivariate ordinal data matrix with categories (1,4) and n=1000 and p=10. thanks alot thanoon [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] simulation of Hierarchical design

2014-02-24 Thread Greg Snow
So can the same student be associated with multiple instructors? only within the same school? or more general? by repeated student ID's do you mean that a student in school A and a student in school B can both have ID 1, but they are different students? or do you mean that instructor #1 and Instr

[R] simulation of Hierarchical design

2014-02-24 Thread farnoosh sheikhi
Hi, I want to simulate a data set with following condition: There are 6 states with 12 schools. Each two schools are coming from one states. For example school one and two from state A, school 3 and 4 from state B and etc. Each school has 10 unique instructors with random number of students mea

[R] Simulation study in R for categorical repeated measures data

2013-11-18 Thread Buddhini Gawarammana
Hi everyone, I am interested in doing a study to compare three analyzing methods namely, ANOVA, GEE and multilevel approach for *categorical repeated measures data using a simulation study in R*. I am not an expert in R but I know some preliminaries in R. Therefore I am desperately looking for some

Re: [R] Simulation in R

2013-08-04 Thread Prof Brian Ripley
On 04/08/2013 09:30, Rui Barradas wrote: Hello, See the help page for ?sample. X <- sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75)) Hope this helps, ?rbinom would have been a better answer since simpler, faster, algorithms are available in that case. Or even as.integer(runif(100

Re: [R] Simulation in R

2013-08-04 Thread Preetam Pal
Thank you very much guys On Sun, Aug 4, 2013 at 3:51 PM, Prof Brian Ripley wrote: > On 04/08/2013 09:30, Rui Barradas wrote: > >> Hello, >> >> See the help page for ?sample. >> >> X <- sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75)) >> >> Hope this helps, >> > > ?rbinom would have been

Re: [R] Simulation in R

2013-08-04 Thread Jeff Newmiller
So you looked at some unspecified help pages online and tried some unspecified stuff? Try being more specific next time you post. For example, try reading the footer of any R-help email. Note that it says read the Posting Guide, and provide a reproducible example (at least of what you tried that

Re: [R] Simulation in R

2013-08-04 Thread Rui Barradas
Hello, See the help page for ?sample. X <- sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75)) Hope this helps, Rui Barradas Em 04-08-2013 08:51, Preetam Pal escreveu: Hi All, I want to simulate a random variable X which takes values 1 and 0 with probabilities 75% and 25% respectively

[R] Simulation in R

2013-08-04 Thread Preetam Pal
Hi All, I want to simulate a random variable X which takes values 1 and 0 with probabilities 75% and 25% respectively and then repeat the procedure 1 times. I am sure this is trivial, I tried to look at the help pages online, but I can't quite find it. Appreciate your help. Thanks and Reg

Re: [R] simulation from truncated skew normal

2013-06-12 Thread Mikhail Umorin
I am not aware of any such command so, I think, you may have to write one yourself: invert the CDF and use uniform random variable (runif) to sample Mikhail On Tuesday, June 11, 2013 16:18:59 cassie jones wrote: > Hello R-users, > > I am trying to simulate from truncated skew normal distributi

[R] simulation from truncated skew normal

2013-06-11 Thread cassie jones
Hello R-users, I am trying to simulate from truncated skew normal distribution. I know there are ways to simulate from skewed normal distribution such as rsn(sn) or rsnorm(VGAM), but I could not find any command to simulate from a truncated skew-normal distribution. Does anyone know how to do that

Re: [R] simulation\bootstrap of list factors

2013-04-18 Thread Adams, Jean
Tobias, I'm not sure if this is what you're after, but perhaps it will help. # create a list of 5 vectors n <- 5 subsets <- lapply(1:n, function(x) rnorm(5, mean=80, sd=1)) # create another list that takes 2 bootstrap samples from each of the 5 vectors and puts them in a matrix nbootstrap <- 2 t

[R] simulation\bootstrap of list factors

2013-04-17 Thread Berg, Tobias van den
Dear R experts, I am trying to simulate a list containing data matrices. Unfortunately, I don't manage to get it to work. A small example: n=5 nbootstrap=2 subsets<-list() for (i in 1:n){ subsets[[i]] <- rnorm(5, mean=80, sd=1) for (j in 1:nbootstrap){ test<-list()

Re: [R] Why R simulation gives same random results?

2013-02-21 Thread Greg Snow
Look at the harvestr package for one way to control multiple parallel simulations and make sure that they have different seeds. On Wed, Feb 20, 2013 at 4:24 PM, C W wrote: > Thanks, Greg. I think you are right. I did simulation one right after > the other, less than 2 seconds. > > But still,

Re: [R] Why R simulation gives same random results?

2013-02-20 Thread Prof Brian Ripley
On 20/02/2013 23:13, Greg Snow wrote: To know for sure we need to know how you are running these different R sessions, but here are some possibilities: The help page for "set.seed" says that if no seed exists then the seed is set based on the current time (and since 2.14.0 the process ID). So o

Re: [R] Why R simulation gives same random results?

2013-02-20 Thread C W
Thanks, Greg. I think you are right. I did simulation one right after the other, less than 2 seconds. But still, it was shocking to see identical samples, which I had to throw away. As a rule of thumb, should I do simulation in one R console, rather than splitting the work into 2 consoles. I j

Re: [R] Why R simulation gives same random results?

2013-02-20 Thread Greg Snow
To know for sure we need to know how you are running these different R sessions, but here are some possibilities: The help page for "set.seed" says that if no seed exists then the seed is set based on the current time (and since 2.14.0 the process ID). So one possibility is that 2 of the sessions

Re: [R] Why R simulation gives same random results?

2013-02-20 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of C W > Sent: Tuesday, February 19, 2013 5:32 PM > To: r-help > Subject: [R] Why R simulation gives same random results? > > Hi, list > I am doing 100

[R] Why R simulation gives same random results?

2013-02-19 Thread C W
Hi, list I am doing 100,000 iterations of Bayesian simulations. What I did is I split it into 4 different R sessions, each one runs 25,000 iteration. But two of the sessions gave the simulation result. I did not use any set.seed(). What is going on here? Thanks, Mike [[alternative HTM

Re: [R] simulation

2013-01-03 Thread Berend Hasselman
On 03-01-2013, at 17:40, Simone Gogna wrote: > Dear R users, > suppose we have a random walk such as: > > v_t+1 = v_t + e_t+1 > > where e_t is a normal IID noise pocess with mean = m and standard deviation = > sd and v_t is the fundamental value of a stock. > > Now suppose I want a trading s

Re: [R] simulation

2013-01-03 Thread Berend Hasselman
On 03-01-2013, at 17:40, Simone Gogna wrote: > Dear R users, > suppose we have a random walk such as: > > v_t+1 = v_t + e_t+1 > > where e_t is a normal IID noise pocess with mean = m and standard deviation = > sd and v_t is the fundamental value of a stock. > > Now suppose I want a trading s

[R] simulation

2013-01-03 Thread Simone Gogna
Dear R users, suppose we have a random walk such as: v_t+1 = v_t + e_t+1 where e_t is a normal IID noise pocess with mean = m and standard deviation = sd and v_t is the fundamental value of a stock. Now suppose I want a trading strategy to be: x_t+1 = c(v_t – p_t) where c is a costant. I kn

Re: [R] Simulation in R

2012-12-01 Thread Greg Snow
look at functions replicate and mvrnorm functions (the later in the MASS package). On Sat, Dec 1, 2012 at 12:02 PM, mboricgs wrote: > Hello! > > How can I do 100 simulations of length 17 from bivariate bivariate normal > distribution, if I know all 5 parameters? > > > > -- > View this message

[R] Simulation in R

2012-12-01 Thread mboricgs
Hello! How can I do 100 simulations of length 17 from bivariate bivariate normal distribution, if I know all 5 parameters? -- View this message in context: http://r.789695.n4.nabble.com/Simulation-in-R-tp4651578.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Simulation with cpm package

2012-11-19 Thread Uwe Ligges
On 13.11.2012 15:45, Christopher Desjardins wrote: Hi, I am running the following code based on the cpm vignette's code. I believe the code is syntactically correct but it just seems to hang R. I can get this to run if I set the sims to 100 but with 2000 it just hangs. Any ideas why? No: Work

[R] Simulation with cpm package

2012-11-13 Thread Christopher Desjardins
Hi, I am running the following code based on the cpm vignette's code. I believe the code is syntactically correct but it just seems to hang R. I can get this to run if I set the sims to 100 but with 2000 it just hangs. Any ideas why? Thanks, Chris library(cpm) cpmTypes <- c("Kolmogorov-Smirnov","M

[R] Simulation of genetic data

2012-09-02 Thread james power
Hi, I am looking for the best way or best package available for simulating a genetic association between a specific SNP and a quantitative phenotype. All of the packages I saw in R seem to be specialised in pedigree data or in population data where coalescence and other evolutionary factors are sp

[R] simulation of modified bartlett's test

2012-06-04 Thread dila
Hi, I run this code to get the power of the test for modified bartlett's test..but I'm not really sure that my coding is right.. #normal distribution unequal variance asim<-5000 pv<-rep(NA,asim) for(i in 1:asim) {print(i) set.seed(i) n1<-20 n2<-20 n3<-20 mu<-0 sd1<-sqrt(25) sd2<-sqrt(50) sd3<-sqrt

[R] simulation of modified bartlett's test

2012-06-04 Thread dila
Hi, I run this code to get the power of the test for modified bartlett's test..but I'm not really sure that my coding is right.. #normal distribution unequal variance asim<-5000 pv<-rep(NA,asim) for(i in 1:asim) {print(i) set.seed(i) n1<-20 n2<-20 n3<-20 mu<-0 sd1<-sqrt(25) sd2<-sqrt(50) sd3<-sqrt

Re: [R] simulation of levene's test

2012-05-28 Thread R. Michael Weylandt
On Mon, May 28, 2012 at 12:14 PM, Özgür Asar wrote: > Dear Dila, > > Try the following: > > library(Rcmdr) Or avoid the unncessary overhead of Rcmdr and use library(car) to provide levenTest instead. > asim <- 1000 > pv<-NULL It's also many orders of magnitude more efficient to preallocate "

Re: [R] simulation of levene's test

2012-05-28 Thread Özgür Asar
Dear Dila, Try the following: library(Rcmdr) asim <- 1000 pv<-NULL for(i in 1:asim) { print(i) set.seed(i) g1 <- rnorm(20,0,2) g2 <- rnorm(20,0,2) g3 <- rnorm(20,0,2) x <- c(g1,g2,g3) group<-as.factor(c(rep(1,20),rep(2,20),rep(3,20))) pv<-c(pv,leveneTest(x,group)$"Pr(>F)"[1]) } Best Ozgur

[R] simulation of levene's test

2012-05-28 Thread dila
hello, I try to run simulation of levene's test to find the p-value but the error of replacement has length zero occur, could anyone help me to fix this problem? asim <- 1000 pv<-rep(NA,asim) for(i in 1:asim) {print(i) set.seed(i) g1 <- rnorm(20,0,2) g2 <- rnorm(20,0,2) g3 <- rnorm(20,0,2) x

Re: [R] simulation

2012-04-05 Thread David Winsemius
On Apr 5, 2012, at 10:57 PM, Christopher Kelvin wrote: Hello, i need to simulate 100 times, n=40 , the distribution has 90% from X~N(0,1) + 10% from X~N(20,10) Is my loop below correct? Thank you n=40 for(i in 1:100){ x<-rnorm(40,0,1) # 90% of n You are overwriting x and y and at the end o

[R] simulation

2012-04-05 Thread Christopher Kelvin
Hello, i need to simulate 100 times, n=40 ,  the distribution has 90% from X~N(0,1) + 10% from X~N(20,10) Is my loop below correct? Thank you n=40 for(i in 1:100){ x<-rnorm(40,0,1)  # 90% of n z<-rnorm(40,20,10)  # 10% of n } x+z __ R-help@r-project.o

[R] Simulation confidence interval

2012-02-01 Thread Scott Raynaud
The follwing is a code snippet from a power simulation program that I'm using:   estbeta<-fixef(fitmodel)  sdebeta<-sqrt(diag(vcov(fitmodel)))   for(l in 1:betasize)   {     cibeta<-estbeta[l]-sgnbeta[l]*z1score*sdebeta[l]     if(beta[l]*cibeta>0)  powaprox[[l]]<-powaprox[[l]]+1  

Re: [R] simulation

2011-12-16 Thread Bert Gunter
Suggestions? -- Yes. 1) Wrong list.. Post on R-sig-mixed-models, not here. 2) Follow the posting guide and provide the modelformula, which may well be the source of the difficulties (overfitting). -- Bert On Fri, Dec 16, 2011 at 1:56 PM, Scott Raynaud wrote: > I'm using an R program (which I d

[R] simulation

2011-12-16 Thread Scott Raynaud
I'm using an R program (which I did not write) to simulate multilevel data (subjects in locations) used in power calculations. It uses lmer to fit a mixed logistic model to the simulated data based on inputs of means, variances, slopes and proportions:   (fitmodel <- lmer(modelformula,data,famil

Re: [R] Simulation over data repeatedly for four loops

2011-11-13 Thread R. Michael Weylandt
Perhaps you might want to abstract your code a bit and try something like: X = rnorm(500) # Some Data replicate(1e4, mean(sample(X, 500, replace = T))) Obviously you can set up a loop over your data sets as needed. Michael On Sat, Nov 12, 2011 at 6:46 PM, Francesca wrote: > Dear Contributors,

[R] Simulation over data repeatedly for four loops

2011-11-12 Thread Francesca
Dear Contributors, I am trying to perform a simulation over sample data, but I need to reproduce the same simulation over 4 groups of data. My ability with for loop is null, in particular related to dimensions as I always get, no matter what I try, "number of items to replace is not a multiple

Re: [R] Simulation from discrete uniform

2011-10-26 Thread Mehmet Suzen
Why don't you use sample; > sample(1:10,10,replace=TRUE) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of BSanders Sent: 26 October 2011 08:49 To: r-help@r-project.org Subject: Re: [R] Simulation from discrete uniform If yo

Re: [R] Simulation from discrete uniform

2011-10-26 Thread BSanders
If you wanted a discrete uniform from 1-10 use: ceiling(10*runif(1)) if you wanted from 0-12, use: ceiling(13*runif(1))-1 -- View this message in context: http://r.789695.n4.nabble.com/Simulation-from-discrete-uniform-tp3434980p3939694.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] simulation for equation with two variables

2011-07-21 Thread David Winsemius
On Jul 21, 2011, at 1:42 PM, Benjamin Caldwell wrote: That is, run all possible combinations of the two vectors through the equation. *Ben * For "all combinations" the usual route is data preparation with either expand.grid() or outer() On Thu, Jul 21, 2011 at 10:04 AM, Benjamin Caldwel

Re: [R] simulation for equation with two variables

2011-07-21 Thread Benjamin Caldwell
That is, run all possible combinations of the two vectors through the equation. *Ben * On Thu, Jul 21, 2011 at 10:04 AM, Benjamin Caldwell wrote: > Hi, > I'm trying to run a basic simulation and sensitivity test by running an > equation with two variables and then plotting the results against

[R] simulation for equation with two variables

2011-07-21 Thread Benjamin Caldwell
Hi, I'm trying to run a basic simulation and sensitivity test by running an equation with two variables and then plotting the results against each of the vectors. R is running the vectors like this : 0 with 0, 1 with 1, etc. I would like it to run them like 0 for 1:100, 1 for 1:100, and then the re

Re: [R] simulation

2011-06-06 Thread Petr Savicky
On Mon, Jun 06, 2011 at 04:50:57PM +1000, Stat Consult wrote: > Dear ALL > I want to simulate data from Multivariate normal distribution. > GE.N<-mvrnorm(25,mu,S) > S <-matrix(rep(0,1),nrow=100) > for( i in 1:100){sigma<-runif(100,0.1,10);S > [i,i]=sigma[i];mu<-runif(100,0,10)} > for (i in 1:20

[R] simulation

2011-06-06 Thread Stat Consult
Dear ALL I want to simulate data from Multivariate normal distribution. GE.N<-mvrnorm(25,mu,S) S <-matrix(rep(0,1),nrow=100) for( i in 1:100){sigma<-runif(100,0.1,10);S [i,i]=sigma[i];mu<-runif(100,0,10)} for (i in 1:20){for (j in 1:20){if (i != j){S [i,j]=0.3*sigma[i]*sigma[j]}}} for (i in 21:

[R] simulation

2011-05-30 Thread Stat Consult
Dear ALL I want to simulate data from Multivariate normal distribution. GE.N<-mvrnorm(25,mu,S) S <-matrix(rep(0,1),nrow=100) for( i in 1:100){sigma<-runif(100,0.1,10);S [i,i]=sigma[i];mu<-runif(100,0,10)} for (i in 1:20){for (j in 1:20){if (i != j){S [i,j]=0.3*sigma[i]*sigma[j]}}} for (i

Re: [R] Simulation from discrete uniform

2011-05-29 Thread Jorge Ivan Velez
Hi Serdar, Take a look at the following: > sample(0:9, 100, replace = FALSE) Error in sample(0:9, 100, replace = FALSE) : cannot take a sample larger than the population when 'replace = FALSE' > sample(0:9, 100, replace = TRUE) [1] 5 6 5 7 3 0 8 4 8 2 2 4 7 6 0 7 0 0 0 7 5 6 3 6 0 9 6 1 2 6 9

Re: [R] Simulation from discrete uniform

2011-05-29 Thread SERDAR NESLIHANOGLU
Hi Also , same problem to create discrete uniform Distribution , But sample () and runif() not useful to generate discrete uniform . Ex: > u<-round(runif(10*10,min=1,max=10),0) > table(u) u 1 2 3 4 5 6 7 8 9 10 6 10 9 10 14 6 11 14 12 8 Not useful for large number OR

Re: [R] simulation from truncated poisson

2011-05-16 Thread cassie jones
--Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of cassie jones > Sent: Monday, May 16, 2011 5:28 PM > To: r-help@r-project.org > Subject: [R] simulation from truncated poisson > > Dear all, > > I need to simul

Re: [R] simulation from truncated poisson

2011-05-16 Thread cassie jones
uniform between that value and 1, then feed that > uniform into the qpois function. > > > > *From:* cassie jones [mailto:cassiejone...@gmail.com] > *Sent:* Monday, May 16, 2011 7:46 PM > *To:* Greg Snow > *Cc:* r-help@r-project.org > *Subject:* Re: [R] simulation from tr

Re: [R] simulation from truncated poisson

2011-05-16 Thread Greg Snow
l.com] Sent: Monday, May 16, 2011 7:46 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] simulation from truncated poisson It is truncated from left. On Mon, May 16, 2011 at 6:33 PM, Greg Snow mailto:greg.s...@imail.org>> wrote: Which direction is it truncated? (only values

Re: [R] simulation from truncated poisson

2011-05-16 Thread Greg Snow
: Monday, May 16, 2011 5:28 PM To: r-help@r-project.org Subject: [R] simulation from truncated poisson Dear all, I need to simulate values from a Poisson distribution which is truncated at certain value 'a'. Can anyone tell me if there is in-built package in R which can simulate from a

[R] simulation from truncated poisson

2011-05-16 Thread cassie jones
Dear all, I need to simulate values from a Poisson distribution which is truncated at certain value 'a'. Can anyone tell me if there is in-built package in R which can simulate from a truncated Poisson? If not, what should be the steps to write a function which would do that? Thanks in advance.

Re: [R] Simulation Questions

2011-05-02 Thread Andrew Robinson
Hi Shane, it sounds to me as though you have a fairly well-defined problem. You want to generate random numbers with a specific mean, variance, and correlation with another random varaible. I would reverse-enginerr the fuinctions for simple linear regression to get a result like y = beta_0 + be

[R] Simulation Questions

2011-04-30 Thread Shane Phillips
I have the following script for generating a dataset. It works like a champ except for a couple of things. 1. I need the variables "itbs" and "map" to be negatively correlated with the binomial variable "lunch" (around -0.21 and -0.24, respectively). The binomial variable "lunch" needs to

Re: [R] Simulation from discrete uniform

2011-04-07 Thread Søren Højsgaard
?sample -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af cassie jones Sendt: 8. april 2011 03:16 Til: r-help@r-project.org Emne: [R] Simulation from discrete uniform Dear all, I am trying to simulate from discrete uniform

Re: [R] Simulation from discrete uniform

2011-04-07 Thread Dennis Murphy
Hi: Suppose X has a discrete uniform distribution on the sample space S = {0, 1, 2, ..., 9}. Then a random sample of size 100 from this distribution, for example, would be dus <- sample(0:9, 100, replace = TRUE) # Checks: table(dus) lattice::barchart( ~ table(dus), xlim = c(0, 20)) The sample sp

[R] Simulation from discrete uniform

2011-04-07 Thread cassie jones
Dear all, I am trying to simulate from discrete uniform distribution. But I could not find any in-built code in R. Could anyone help me please? Thanks in advance for the time and help. Cassie [[alternative HTML version deleted]] __ R-help

Re: [R] Simulation

2011-03-01 Thread Mike Marchywka
> Date: Mon, 28 Feb 2011 19:18:18 -0800 > From: kadodamb...@hotmail.com > To: r-help@r-project.org > Subject: [R] Simulation > > I tried looking for help but I couldn't locate the exact solution. > I have data that has sever

Re: [R] Simulation

2011-03-01 Thread Ivan Calandra
Well, knowing how your data looks like would definitely help! Say your data object is called "mydata", just paste the output from dput(mydata) into the email you want to send to the list. Ivan Le 3/1/2011 04:18, bwaxxlo a écrit : I tried looking for help but I couldn't locate the exact solutio

[R] Simulation

2011-03-01 Thread bwaxxlo
I tried looking for help but I couldn't locate the exact solution. I have data that has several variables. I want to do several sample simulations using only two of the variables (eg: say you have data between people and properties owned. You only want to check how many in the samples will come up

Re: [R] Simulation of Multivariate Fractional Gaussian Noise and Fractional Brownian Motion

2011-02-11 Thread Wonsang You
Dear Kjetil, Thank you so much for your advice on my question. Best Regards, Wonsang 2011/2/10 Kjetil Halvorsen > What you can do to find out is to type into your R session > RSiteSearch("multivariate fractional gaussian") > > That seems to give some usefull results. > > Kjetil > > On Tue, F

Re: [R] Simulation of Multivariate Fractional Gaussian Noise and Fractional Brownian Motion

2011-02-10 Thread Kjetil Halvorsen
What you can do to find out is to type into your R session RSiteSearch("multivariate fractional gaussian") That seems to give some usefull results. Kjetil On Tue, Feb 8, 2011 at 1:51 PM, Wonsang You wrote: > > Dear R Helpers, > > I have searched for any R package or code for simulating multivar

[R] Simulation of Multivariate Fractional Gaussian Noise and Fractional Brownian Motion

2011-02-08 Thread Wonsang You
Dear R Helpers, I have searched for any R package or code for simulating multivariate fractional Brownian motion (mFBM) or multivariate fractional Gaussian noise (mFGN) when a covariance matrix are given. Unfortunately, I could not find such a package or code. Can you suggest any solution for mul

Re: [R] Simulation - Natrual Selection

2011-01-05 Thread Ben Ward
On 05/01/2011 17:40, Bert Gunter wrote: My hypothesis was specified before I did my experiment. Whilst far from perfect, I've tried to do the best I can to assess rise in resistance, without going into genetics as it's not possible. (Although may be at the next institution I've applied for MSc).

Re: [R] Simulation - Natrual Selection

2011-01-05 Thread Ben Ward
On 05/01/2011 16:37, Mike Marchywka wrote: Date: Wed, 5 Jan 2011 15:48:46 + From: benjamin.w...@bathspa.org To: r-help@r-project.org Subject: [R] Simulation - Natrual Selection Hi, I've been modelling some data over the past few days, of my work, repeatedly challenging microbes

Re: [R] Simulation - Natrual Selection

2011-01-05 Thread Mike Marchywka
> Date: Wed, 5 Jan 2011 15:48:46 + > From: benjamin.w...@bathspa.org > To: r-help@r-project.org > Subject: [R] Simulation - Natrual Selection > > Hi, > > I've been modelling some data over the past few days, of my work, > repeatedly challenging microb

  1   2   3   >