similar to: R: use switch or function in connecting different cases.

Displaying 20 results from an estimated 1000 matches similar to: "R: use switch or function in connecting different cases."

2016 Apr 25
0
use switch or function in connecting different cases.
This is my current work.Now i am trying to use a function to do the normal distribution simulation. rm(list=ls()) t <- u<- mann<- rep(0, 45) Nsimulation<-function(S1,S2,Sds,nSims) { set.seed(1) for (sim in 1:nSims) { matrix_t <-matrix(0,nrow=nSims,ncol=3) matrix_u<-matrix(0,nrow=nSims,ncol=3)
2016 Apr 17
2
R [coding : do not run for every row ]
i have combined all the variables in a matrix, and i wish to conduct a simulation row by row. But i found out the code only works for the every first row after a cycle of nine samples. But after check out the code, i don know where is my mistake... can anyone pls help .... #For gamma disribution with equal skewness 1.5 #to evaluate the same R function on many different sets of data
2016 Apr 18
0
R [coding : do not run for every row ]
Dear anonymous, The big mistake in the output might be obvious to you but not to others. Please make clear what the correct output should be or at least what is wrong with the current output. And please DO read the posting guide which asks you not to post in HTML. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie &
2016 Apr 18
3
R [coding : do not run for every row ]
Hi, i am sorry, the output should be values between 0 and 0.1 and not supposed to be 1.00, it is because they are type 1 error rate. And now i get output 1.00 for several samples,rhis is no correct. The loop do not run for every row. i do not know where is my mistake. As i use the same concept on normal distribution setup, i get the result. Sent from my phone On Thierry Onkelinx
2016 Apr 06
0
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
You have quite a few mistakes in your example. The code below works for me - you can wrap it in a function if you like. I think you will need a lot more practice before you can write something like this in R as you are missing close braces and haven't really worked out the difference between the number of calculations you are doing for each replication and the number of replications. It takes
2016 Apr 06
0
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
Hi, i think i have figured the purpose of using this index (i-1)*5+j in the previous example that you gave. It is because that i have to consider the outer loop and inner loop also... so the iterative for i need to minus one because it have ran one times simulation already ,then times the number of sizes of inner loop, then plus the iterative of j.... then for the simulation, i think there will
2016 Apr 18
0
R [coding : do not run for every row ]
Always keep the mailing list in cc. The code runs for each row in the data. However I get the feeling that there is a mismatch between what you think that is in the data and the actual data. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070
2016 Apr 05
5
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
hi, i am new in this field. do favorite<http://stackoverflow.com/questions/36404707/simulation-study-of-2-sample-test-on-different-combination-of-factors#> If I wish to conduct a simulation on the robustness of two sample test by using R language, is that any ways in writing the code? There are several factors (sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100),
2016 Apr 19
0
problem on simulation code (the loop unable to function effectively)
Hi Jeem, First, please send questions like this to the help list, not me. I assume that you are in a similar position to sjtan who has been sending almost exactly the same questions. The problem is not in the loops (which look rather familiar to me) but in your initial assignments at the top. For instance: scale parameter=(1,1.5,2,2.5,3) produces an error which has nothing to do with the
2016 Apr 19
0
problem on simulation code (the loop unable to function effectively)
Hi Si Jie, Again, please send questions to the list, not me. Okay, I may have worked out what you are doing. The program runs and produces what I would expect in the rightmost columns of the result "g". You are storing the number of each test for which the p value is less than 0.05. It looks to me as though the objects storing the results should be vectors as you are only storing 100 p
2016 Apr 18
0
R [coding : do not run for every row ]
You can make this much more readable with apply functions. result <- apply( all_combine1, 1, function(x){ p.value <- sapply( seq_len(nSims), function(sim){ gamma1 <- rgamma(x["m"], x["sp(skewness1.5)"], x["scp1"]) gamma2 <- rgamma(x["n"], x["scp1"], 1) gamma1 <- gamma1 -
2003 Oct 28
1
error message in simulation
Dear R-users, I am a dentist (so forgive me if my question looks stupid) and came across a problem when I did simulations to compare a few single level and two level regressions. The simulations were interrupted and an error message came out like 'Error in MEestimate(lmeSt, grps) : Singularity in backsolve at level 0, block 1'. My collegue suggested that this might be due to my codes
2005 Aug 04
1
Counterintuitive Simulation Results
I wonder if someone can help me understand some counterintuitive simulation results. Below please find 12 lines of R code that theoretically, to the best of my understanding, should produce essentially a flat line with no discernable pattern. Instead, I see an initial dramatic drop followed by a slow rise to an asymptote. The simulation computes the mean of 20,000 simulated trajectories
2023 Aug 31
1
simulating future observations from heteroscedastic fits
Hello, All: I want to simulate future observations from fits to heteroscedastic data. A simple example is as follows: (DF3_2 <- data.frame(y=c(1:3, 10*(1:3)), gp=factor(rep(1:2, e=3)))) # I want to fit 4 models # and simulate future observations from all 4: fit11 <- lm(y~1, DF3_2) fit21 <- lm(y~gp, DF3_2) library(nlme) (fit12 <- lme(y~1, data=DF3_2,
2017 Jun 12
2
Possible with enableJIT function
In this email to the R-help list: https://stat.ethz.ch/pipermail/r-help/2017-June/447474.html and in this question on Stackoverflow: https://stackoverflow.com/questions/44486643/nleqslv-memory-use-in-r Andrew Leach has raised a question about the memory usage of my package nleqslv. In a model with a loop within a function he has experienced continuously increasing memory usage by package nleqslv
2016 Apr 05
0
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
Okay, here is a more complete example: sample_sizes<- matrix(c(10,10,10,25,25,25,25,50,25,100,50,25,50,100,100,25,100,100), nrow=2) # see what it looks like sample_sizes ssds<-c(4,4.4,5,6,8) nssds<-length(ssds) results<-list() # first loop steps through the sample for(ss in 1:dim(sample_sizes)[2]) { # get the two sample sizes ss1<-sample_sizes[1,ss] ss2<-sample_sizes[2,ss]
2004 Sep 04
0
Non-Markovian Behaviour of a Cusum?
Can someone help me understand simulations of a one-sided Cusum? Consider the following: Q[i] = max(0, Q[i-1]+z[i]), z[i] ~ N(offset, 1), with Q[0] = FIR (fast initial response). With offset < 0, mean{Q[i] for fixed i averaged over many simulations} approaches an asymptote as i -> Inf. In simulations with abs(offset) small and FIR close to the asymptote, Q[i]
2012 Mar 21
1
enableJIT() and internal R completions (was: [ESS-bugs] ess-mode 12.03; ess hangs emacs)
Hello, JIT compiler interferes with internal R completions: compiler::enableJIT(2) utils:::functionArgs("density", '') gives: utils:::functionArgs("density", '') Note: no visible global function definition for 'bw.nrd0' Note: no visible global function definition for 'bw.nrd' Note: no visible global function definition for 'bw.ucv'
2011 Mar 19
2
Output a table formatted with standard deviations below means
Is it in bad form to double post to StackOverflow and R-help? Apologies if so. Here's my task: I've got a matrix of means like so means<-matrix(1:10,nrow=2) colnames(means)<-c("a","b","c","d","e") and a matrix of standard deviations like so sds<-matrix(seq(0.1,1,by=0.1),nrow=2)
2005 Mar 09
2
Question about biasing in sd()???
Hi, Can anyone help me with the following. I have been using R for Monte Carlo simulations and got some results I couldn't explain. Therefor I performed following short test: -------------- mean.sds <- NULL sample.sizes <- 3:30 for(N in sample.sizes){ dum <- NULL for(I in 1:5000){ x <- rnorm(N,0,1) dum <- c(dum,sd(x)) } mean.sds<- c(mean.sds,mean(dum)) }