similar to: Correction in error

Displaying 20 results from an estimated 9000 matches similar to: "Correction in error"

2011 Nov 10
1
Gibbs sampler
I have the following code, gibbs <-function(m,theta = 0.25, lambda =0.55, n =1){ alpha <- 1.5 beta <- 1.5 gamma <- 1.5 x<- array(0,c(m+1, 3)) x[1,1] <- theta x[1,2] <- lambda x[1,3]<- n for(t in 2:(m+1)){ x[t,1] <- rbinom(1, x[t-1,3], x[t-1,1]) x[t,2]<-rbeta(1, x[t-1,1] + alpha, x[t-1,3] - x[t-1,1] + beta) x[t,3]
2011 Nov 09
2
Error in drawing
I have got following error in drawing wavelet fitting. can some one help? > library(faraway) > data(lidar) > newlidar<-lidar[c(1:128),] > library(wavethresh) > wds <- wd(newlidar$logratio) > draw(wds) Error in plot.default(x = x, y = zwr, main = main, sub = sub, xlab = xlab, : formal argument "type" matched by multiple actual arguments [[alternative HTML
2011 Nov 29
3
Problem in log
Hi all I have a function of log defined by y = log(1- exp(-a)), when exp(-a) is greater, 1, it produce NaN. How can I remove this in R? [[alternative HTML version deleted]]
2012 Dec 05
4
Import multiple data frames and combine them using "cbind"
Hi group, I imported 16 data frames using the function "list.files" temp <- list.files(path="...........") myfiles = lapply(temp, read.table,sep = "") Now I have 16 data set imported in R window. I want to combine them by row and tried some thing like (Here I am considering only 20 columns) for(i in 1:16){ data<- cbind(myfiles[[i]][,1:20]) } but it
2012 Apr 06
2
Bayesian 95% Credible interval
Hi all, I have the data from the posterior distribution for some parameter. I want to find the 95% credible interval. I think "t.test(data)" is only for the confidence interval. I did not fine function for the Bayesian credible interval. Could some one suggest me? Thanks [[alternative HTML version deleted]]
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
2012 Aug 27
3
How to generate a matrix of Beta or Binomial distribution
Hi folks, I have a question about how to efficiently produce random numbers from Beta and Binomial distributions. For Beta distribution, suppose we have two shape vectors shape1 and shape2. I hope to generate a 10000 x 2 matrix X whose i th rwo is a sample from reta(2,shape1[i]mshape2[i]). Of course this can be done via loops: for(i in 1:10000) { X[i,]=rbeta(2,shape1[i],shape2[i]) } However,
2011 Nov 18
3
Permutations
Hi all, why factorial(150) shows the error out of range in 'gammafn'? I have to calculate the number of subset formed by 150 samples taking 10 at a time. How is this possible? best [[alternative HTML version deleted]]
2011 Nov 16
2
Error in random walk Metroplis-hasting
Hi R community, I have some data set and construct the likelihood as follows likelihood <- function(alpha,beta){ lh<-1 d<-0 p<-0 k<-NULL data<-read.table("epidemic.txt",header = TRUE) attach(data, warn.conflicts = F) k <-which(inftime==1) d <- (sqrt((x-x[k])^2+(y-y[k])^2))^(-beta) p<-1 - exp(-alpha*d) for(i in 1:100){
2011 Nov 21
1
Sub sets
I'd appreciate it if you'd keep on list for the archives. That said, I think this function does what you were hoping for. Michael powerset <- function(n, items = NULL){ if(!is.null(items)) { if(n != length(items)) warning("Resetting n in preference to length(items)") n = length(items) } smat <- do.call(expand.grid, rep(list(c(0,1)), n))
2011 Nov 08
3
GAM
Hi R community! I am analyzing the data set "motorins" in the package "faraway" by using the generalized additive model. it shows the following error. Can some one suggest me the right way? library(faraway) data(motorins) motori <- motorins[motorins$Zone==1,] library(mgcv) >amgam <- gam(log(Payment) ~ offset(log(Insured))+ s(as.numeric(Kilometres)) + s(Bonus) + Make +
2009 Aug 17
1
Bayesian data analysis - help with sampler function
I have downloaded the Umacs (Universal Markov chain sampler) and submitted the following sample code from Kerman and Gelman.   s <-Sampler( J=8, sigma.y  =c(15,10,16,11,9,11,10,18),           y  =c(28, 8,-3,7,-1,1,18,12),      theta =Gibbs(theta.update,theta.init),           V =Gibbs(V.update,mu.init),         mu =Gibbs(mu.update,mu.init),         tau =Gibbs(tau.update,tau.init),       
2012 Oct 22
1
random forest
Hi all, Can some one tell me the difference between the following two formulas? 1. epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree = 300,xtest = NULL, ytest = NULL,replace = T, proximity =F) 2.epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree = 300,xtest = NULL, ytest = NULL,replace = T, proximity =F) [[alternative HTML version deleted]]
2011 Nov 18
1
Permutation matrix
Hi all, I have a set of elements (1, 1, 0,1,1,0,1,0,1,1) with ten elements. I have to construct the permutation matrix of this set which is of the size 10 by 2^10. Can some one help how is this possible? Is there is a particular function in R or I need to make function? Best [[alternative HTML version deleted]]
2011 Dec 05
1
Problem in while loop
Hi all, I have the following code, When I run the code, it never terminate this is because of the while loop i am using. In general, if you need a loop for which you don't know in advance how many iterations there will be, you can use the `while' statement so here too i don't know the number how many iterations are there. So Can some one suggest me whats going on? I am using the
2012 Oct 01
1
Problem with nls regression fit
Hi all, I got following problem in fitting the data. Any kind of suggestions are welcome > beta <- 3.5 > d <- seq(0.1,62.5,0.1) > y <- exp(-beta*d) > y1 <- y > x <- read.table("epidist.txt", header = TRUE) > data.nls <- as.data.frame(cbind(y1,x)) > #attach(data.nls) > nls.fit <- nls(y1~dist,data.nls) Error in cll[[1L]] : object of type
2007 Dec 27
1
encoding question again
Hi, R Devils, I'm running the actual R version in JGR (version 1.5-8 ). Sys.getlocale(category = "LC_ALL") yields [1] "LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252" I want to write some HTML-Code enhanced by statistical results and labels encoded in Latin-1, which I pass to a function.
2008 Sep 17
3
Is there a way to not use an explicit loop?
I have a problem in where i generate m independent draws from a binomial distribution, say draw1 = rbinom( m , size.a, prob.a ) then I need to use each draw to generate a beta distribution. So, like using a beta prior, binomial likelihood, and obtain beta posterior, m many times. I have not found out a way to vectorize draws from a beta distribution, so I have an explicit for loop
2008 Jan 09
2
labels to values
I couldn't find out how the following to solve: There is a column in a data.frame: > d[, 'Y6'] [1] 6 3 8 11 8 9 6 8 3 5 10 15 NA 9 8 3 8 16 6 6 NA 10 5 2 7 7 6 16 7 15 7 10 12 8 7 12 12 16 7 6 8 8 15 6 [45] NA 8 99 7 12 8 9 16 7 16 8 7 7 1 15 12 8 7 10 7 8 7 8 9 8 6 6 8 6 16 11 5 11 11 1 11 3 7 7 10 10 10 6 11 [89] 16 NA