Displaying 20 results from an estimated 3000 matches similar to: "Sub sets"
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
2011 Nov 07
3
Correction in error
Hello R community, following is my code and it shows error, can some one
fix this error and explain why this occurs?
gibbs <-function(m,n, theta = 0, lambda = 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(x[t-1,3], 1, x[t-1,1])
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]]
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 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 +
2007 Jun 23
1
Creating different matrices in a loop
Hello,
I have a big matrix of size (20,5) -bmat . I have to loop though the rows in
the matrix and create DIFFERENT matrices each time I go through the loop.
counts=c(4,6,10);
p=1;
for (i in 1:length(counts))
{
smat=bmat[p:p+i-1,];
p=p+i;
}
The problem is smat overwrites itself each time inside the loop. I would
like to have smat1, smat2, smat3 instead of a single vector smat.
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
2011 Dec 28
1
Probability Question
Hello,
This is a question from a class I'm not in (it's also winter break). But,
all the same, I don't know where to start in R with this. It's supposed to
be done in R. So, can anyone direct me with a helpful hint or 2, on how to
get started with the question listed below, or tell me how I can re-post
this to Usenet groups sci.stat.consult., so they can help with this
question:
2005 Oct 25
1
Small issue with R's C API
Consider the R code:
mat <- matrix(seq(1,20),4,5)
is.matrix(mat) # gives TRUE
is.vector(mat) # gives FALSE
On the other hand, if mat is passed through the .Call interface the
corresponding SEXP (call it smat) satisfies
isMatrix(smat) // TRUE
isVector(smat) // TRUE
Consequently, you cannot distinguish matrices from vectors. Looking
at the dim attribute of a vector doesn't help because
2005 Apr 18
2
Very Slow Gower Similarity Function
Hello,
I am a relatively new user of R. I have written a basic function to calculate
the Gower similarity function. I was motivated to do so partly as an excercise
in learning R, and partly because the existing option (vegdist in the vegan
package) does not accept missing values.
I think I have succeeded - my function gives me the correct values. However, now
that I'm starting to use it with
2012 Feb 10
6
Importing a CSV file
I have been trying to import a csv file to r. but I get the same message everytime. the message is
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'Users:/sezginozcan/Downloads/beer.data.csv': No such file or directory
I use mac.
I tried this command also
2011 Nov 18
1
number of items to replace is not a multiple of replacement length
Hi all, following is my R -code and shows the error given below
> n <- 100
> k<-2
> x1 <-c(1, 3);x2 <- c(2,5)
> X <- matrix(c(0,0), nrow = 2, ncol = n)
> for(i in 1:k)
+ X[i, ] <- mh1.epidemic(n,x1[i],x2[i])
Error in X[i, ] <- mh1.epidemic(n,x1[i],x2[i]):
number of items to replace is not a multiple of replacement length
> psi <-t(apply(X, c(1,2),
2012 Sep 24
1
knnFinder Package
What is the newest version of package knnFinder? because it was removed
from the CRAN repository.
http://cran.r-project.org/web/packages/knnFinder/
Thanks
[[alternative HTML version deleted]]
2011 Nov 11
1
Random-walk Metropolis-Hasting
Following is my code, can some one help on the error at the bottom?
> mh<-function(iterations,alpha,beta){
+ data<-read.table("epidemic.txt",header = TRUE)
+ attach(data, warn.conflicts = F)
+ k<-97
+ d <- (sqrt((x-x[k])^2 + (y-y[k])^2))
+ p <- 1-exp(-alpha*d^(-beta))
+ p.alpha<-1 - exp(-3*d^(-beta))
+ p.beta <- 1 - exp(alpha*d^(-2))
+