similar to: loop troubles

Displaying 20 results from an estimated 100 matches similar to: "loop troubles"

2007 Jun 08
1
Need Help with robustbase package: fitnorm2 and plotnorm2
This is my first post requesting help to this mailing list. I am new to R. My apologies for any breach in posting etiquette. I am new to this language and just learning my way around. I am attempting to run some sample code and and am confused by the error message: Loading required package: rrcov Error in fitNorm2(fdat[, "FSC-H"], fdat[, "SSC-H"], scalefac = ScaleFactor) :
2010 Nov 18
0
On efficiency, Vectorize and loops
In my last e-mails, I have asked for help regarding 1. 'defining functions inside loops' 2. 'integrating functions / vector arithmetics' 3. 'vectors out of lists?' 4. 'numerical integration' Since some of these topics seemed to be relevant (I'm guessing by the # of replies I got), I'm posting a modified section of my code. Any thoughts on improvements would
2010 Jun 13
1
using latticeExtra plotting confidence intervals
I am wanting to plot a 95% confidence band using segplot, yet I am wanting to have groups. For example if I have males and females, and then I have them in different races, I want the racial groups in different panels. I have this minor code, completely made up but gets at what I am wanting, 4 random samples and 4 samples of confidence, I know how to get A & B into one panel and C&D in to
2003 Nov 24
2
Questions on Random Forest
Hi, everyone, I am a newbie on R. Now I want to do image pixel classification by random forest. But I has not a clear understanding on random forest. Here is some question: As for an image, for example its size is 512x512 and has only one variable -- gray level. The histogram of the image looks like mixture Gaussian Model, say Gauss distribution (u1,sigma1), (u2,sigma2),(u3,sigma3). And a
2014 Jun 19
2
Principal component analysis with EQUAMAX rotation
Hello, I need to do a principal component analysis with EQUAMAX-rotation. Unfortunately the function principal() I use normally for PCA does not offer this rotation specification. I could find out that this might be possible somehow with the package GPArotation but until now I could not figure out how to use this in the principal component analysis. Maybe someone can give an example on how to do
2017 Aug 24
1
Problem in optimization of Gaussian Mixture model
Hello, I am facing a problem with optimization in R from 2-3 weeks. I have some Gaussian mixtures parameters and I want to find the maximum in that *Parameters are in the form * mean1 mean2 mean3 sigma1 sigma2 sigma3 c1 c2 c3 506.8644 672.8448 829.902 61.02859 9.149168 74.84682 0.1241933 0.6329082 0.2428986 I have used optima and optimx to find the
2004 Nov 16
5
Difference between two correlation matrices
Hi Now a more theoretical question. I have two correlation matrices - one of a set of variables under a particular condition, the other of the same set of variables under a different condition. Is there a statistical test I can use to see if these correlation matrices are "different"? Thanks Mick
2009 May 03
3
Optim function in the loop
Hi all, I wrote the following lines of codes try to do some iterations to find the global optimal values, but the function does not execute properly. Every time codes stop after one iteration right after executing the optim() function. Does anyone could have me to take a look? Thanks. if (count>0){ k=k+0.05; mu0=c(83+k,0,0) Sigma0= diag(0.4,3) initpar=c(.1+10*k,10*k,10*k,10*k) # initial
2008 Feb 15
1
Questions about EM algorithm
Dear all: Assume I have 3 distributions, x1, x2, and x3. x1 ~ normal(mu1, sd1) x2 ~ normal(mu2, sd2) x3 ~ normal(mu3, sd3) y1 = x1 + x2 y2 = x1 + x3 Now that the data I can observed is only y1 and y2. It is easy to estimate (mu1+m2), (mu1+mu3), (sd1^2+sd2^2) and (sd1^2+sd3^2) by EM algorithm since y1 ~ normal(mu1+mu2, sqrt(sd1^2+sd2^2)) and y2 ~ normal(mu1+mu3, sqrt(sd1^2+sd3^2)) However, I want
2009 Mar 30
0
Problem in S4 object displaying from within a Java application using JRI
I am using JRI (Java R Interface) library in order to call R from within my Java application. But since the "rmu1" and "rmu2" ,see the following code, are objects of type S4 once i run the application the value of Null will be returned for both of them. On this regard, i would appreciate it if anyone can tell me how i am going to display and/ or convert these objects to Java
2010 Oct 08
5
saving object function
Ok so if I have a function: functest<-function(x){ a<-x+1 b<-x+2 c<-x+3 paste(a) paste(b) paste(c) } Now I know I can do cat(), or return() on one of them but if I was to run the function with any number, how could I create objects to save so I could do, I am wondering if I have more than one object within my function. functest$a
2006 May 21
2
nls & fitting
Dear All, I may look ridiculous, but I am puzzled at the behavior of the nls with a fitting I am currently dealing with. My data are: x N 1 346.4102 145.428256 2 447.2136 169.530634 3 570.0877 144.081627 4 721.1103 106.363316 5 894.4272 130.390552 6 1264.9111 36.727069 7 1788.8544 52.848587 8 2449.4897 25.128742 9 3464.1016 7.531766 10 4472.1360 8.827367 11
2009 Oct 31
1
Help me improving my code
Hi, I am new to R. My problem is with the ordered logistic model. Here is my question: Generate an order discrete variable using the variable wrwage1 = wages in first full calendar quarter after benefit application in the following way: * wage*1*Ordered *= 1 *if*0 *· wrwage*1 *< *1000 2 *if*1000 *· wrwage*1 *< *2000 3 *if*2000 *· wrwage*1 *< *3000 4 *if*3000 *· wrwage*1 *<
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users, I used to "OPTIM" to minimize the obj. function below. Even though I used the true parameter values as initial values, the results are not very good. How could I improve my results? Any suggestion will be greatly appreciated. Regards, Kathryn Lord #------------------------------------------------------------------------------------------ x = c(0.35938587,
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users, I used to "OPTIM" to minimize the obj. function below. Even though I used the true parameter values as initial values, the results are not very good. How could I improve my results? Any suggestion will be greatly appreciated. Regards, Kathryn Lord #------------------------------------------------------------------------------------------ x = c(0.35938587,
2013 Apr 22
0
Copula fitMdvc:
Hello, I am trying to do a fit a loglikelihood function with Multivariate distribution via copulas with fitMdvc. The problem is that it doesn't recognize that my beta is a vector of km parameter and when I try to run it it say that the length of my initial values is not the same as the parameter. Can somebody guide me where my mistake is. Thanks, Elisa. #################################
2010 Mar 20
2
EM algorithm in R
Please help me in writing the R code for this problem. I've been solving this for 4 days. It was hard for me to solve it. It's a simulation problem in R. The problem is My true model is a normal mixture which is given as 0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components. I will get a random sample of size 100 from this model. I will do this 300 times. That means, I will have
2009 Feb 14
2
anova help
Hi all, I am trying to run a two factor anova, but one of the factors is a random factor, now I am also running in SPSS and it seems its dividing by the wrong term to get the appropriate F term. here is my data. In SPSS the F scores about double the ones in R, how can I specify one of my factors as a random factor or change it to where it does the right model fitting? I am using the lm command
2011 Jan 31
2
Rubin's rules of multiple imputation
Hello all, if I have multiple imputed data sets, is there a command or function in R in any package you know of to combine those, I know one common MI approach is rubins rules, is there a way to do this using his rules or others? I know theres ways, like using Amelia from Gary King's website to create the imputed data sets, but how to make them into one or combine them for analysis.
2009 Aug 20
1
Understanding R code
What is 1. par.ests <- optimfit$par 2. fisher <- hessb(negloglik, par.ests, maxvalue=maxima); 3. varcov <- solve(fisher); 4. par.ses <- sqrt(diag(varcov)); Thanks a lot, fit.GEV <- function(maxima) { sigma0 <- sqrt((6. * var(maxima))/pi) mu0 <- mean(maxima) - 0.57722 * sigma0 xi0 <- 0.1 theta <- c(xi0, mu0, sigma0) #10/5/2007: removed assign() for maxima.nl