[R] Two dimensional likelihood surface plot

2014-11-11 Thread Gyanendra Pokharel
Hi R users, I am trying to plot two dimensional posterior likelihood surface. I have a data like para1 para2 likehood ... ... ... ... I looked at contour plot but it needs a shorted values of parameters and a matrix of

Re: [R] Two dimensional likelihood surface plot

2014-11-11 Thread Gyanendra Pokharel
Thanks David, what do you mean by organized data in regular manner? Gyanendra Pokharel University of Guelph Guelph, ON On Tue, Nov 11, 2014 at 3:53 PM, David Winsemius dwinsem...@comcast.net wrote: On Nov 11, 2014, at 11:17 AM, Gyanendra Pokharel wrote: Hi R users, I am trying to plot

Re: [R] Two dimensional likelihood surface plot

2014-11-11 Thread Gyanendra Pokharel
Thanks a lot, David ! Thats what I wanted. it is greatly helpful. GP University of Guelph Guelph, ON On Tue, Nov 11, 2014 at 7:02 PM, David Winsemius dwinsem...@comcast.net wrote: On Nov 11, 2014, at 2:53 PM, Gyanendra Pokharel wrote: Thanks David, what do you mean by organized data

[R] Help to install package mlegp

2014-08-21 Thread Gyanendra Pokharel
) : there is no package called ‘mlegp’ Can some one suggest me whats going on? Gyanendra Pokharel University of Guelph Guelph, ON [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Help to install package mlegp

2014-08-21 Thread Gyanendra Pokharel
Thanks Uwe! I re-install R and re-install the package mlegp and I successfully installed it. Thanks again ! Gyan Gyanendra Pokharel University of Guelph Guelph, ON On Thu, Aug 21, 2014 at 6:36 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 22.08.2014 00:15, Gyanendra Pokharel

[R] Package gptk, no default option

2014-08-05 Thread Gyanendra Pokharel
Hi there, Could someone explain the input options in the function gpCreat(q,d,X,y,options) in package gptk? I tried looking at the program gpOptions.R but did not get the way to input the option Many thanks Gyan .. Gyanendra Pokharel University of Guelph Guelph

Re: [R] Naming columns

2013-08-27 Thread Gyanendra Pokharel
Import data: mydata - read.table(filename.txt) give following command for column name colnames(mydata) - c(V1,V2,V3,) Gyanendra Pokharel University of Guelph Guelph, ON On Mon, Aug 26, 2013 at 5:42 PM, Docbanks84 mban...@partners.org wrote: Hi , I just imported a large data

Re: [R] error message solution: cannot allocate vector of size 200Mb

2013-05-23 Thread Gyanendra Pokharel
Try in R 64 bit. Thanks Gyanendra Pokharel University of Guelph Guelph, ON On Thu, May 23, 2013 at 10:53 AM, Ray Cheung ray1...@gmail.com wrote: Dear All, I wrote a program using R 2.15.2 but this error message cannot allocate vector of size 200Mb appeared. I want to ask in general how

Re: [R] Netcdf file in R

2013-02-22 Thread Gyanendra Pokharel
I can't see your attached file. Can you re-attache it? Thanks Gyanendra Pokharel University of Guelph Guelph, ON On Fri, Feb 22, 2013 at 7:58 AM, Anup khanal za...@hotmail.com wrote: Good afternoon, I am a new in R. I have to work with large climate data.I am not able to read the netcdf

Re: [R] Import multiple data frames and combine them using cbind

2012-12-05 Thread Gyanendra Pokharel
I am sorry David, I don't mean to give the answer of the impossible questions. Just you can say impossible. If there is no way to do what I explained, that's fine, we do have other alternatives what I wrote in the beginning. Thank you so much. On Wed, Dec 5, 2012 at 1:12 PM, David Winsemius

Re: [R] Import multiple data frames and combine them using cbind

2012-12-05 Thread Gyanendra Pokharel
Thanks Berend, your Idea is great, that,s what I was looking. Thanks again On Wed, Dec 5, 2012 at 2:06 PM, Berend Hasselman b...@xs4all.nl wrote: do.call(cbind,lapply(mydf, function(df) df[,1:2])) [[alternative HTML version deleted]] __

[R] Import multiple data frames and combine them using cbind

2012-12-04 Thread Gyanendra Pokharel
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

Re: [R] Import multiple data frames and combine them using cbind

2012-12-04 Thread Gyanendra Pokharel
, Dec 4, 2012 at 9:37 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: 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

Re: [R] Import multiple data frames and combine them using cbind

2012-12-04 Thread Gyanendra Pokharel
you used the plyr package, you could have done this in one shot: library(plyr) DF - ldply(llply(temp, read.table), rbind) The inner llply call is equivalent to your lapply() and the outer ldply() is equivalent to Jim's do.call() code. Dennis On Tue, Dec 4, 2012 at 6:37 PM, Gyanendra

[R] random forest

2012-10-21 Thread Gyanendra Pokharel
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 =

Re: [R] random forest

2012-10-21 Thread Gyanendra Pokharel
$gamma, na.action = na.fail,ntree = 300,xtest = NULL, ytest = NULL,replace = T, proximity =F) which one is the correct form of random forest? Thanls On Sun, Oct 21, 2012 at 9:59 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: Hi all, Can some one tell me the difference between

[R] Random Forest for multiple categorical variables

2012-10-16 Thread Gyanendra Pokharel
Dear all, I have the following data set. V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 alpha beta 1111 111 111 11111alpha beta1 2122 122 12 2 12212alpha beta1 3133 133 13 3 13 313alpha beta1 4

[R] Problem with nls regression fit

2012-10-01 Thread Gyanendra Pokharel
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

[R] Bayesian 95% Credible interval

2012-04-06 Thread Gyanendra Pokharel
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

[R] Fwd: Importing a CSV file

2012-02-10 Thread Gyanendra Pokharel
-- Forwarded message -- From: Gyanendra Pokharel gyanendra.pokha...@gmail.com Date: Fri, Feb 10, 2012 at 11:13 AM Subject: Re: [R] Importing a CSV file To: sezgin ozcan szgoz...@gmail.com You save your file in your own folder either in desktop or in document where ever you want

Re: [R] Problem in while loop

2011-12-06 Thread Gyanendra Pokharel
at probaccept = 1 or 2) so slow it just feels endless. Either way, my prescription is the same: print() Michael On Dec 5, 2011, at 9:30 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: Yes, your function out- epiann(f = function(a,b) log(dnorm(a)*dnorm(b))), N = 10) works well

Re: [R] Problem in while loop

2011-12-06 Thread Gyanendra Pokharel
Thanks Michael, I am able to find the very nice plot of the function we discussed but still have the problem of ploting the function loglikelihood(aout,bout) versus aout posted in the initial massage. Best On Tue, Dec 6, 2011 at 10:40 AM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote

[R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
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

Re: [R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
count - count +1 } fmin - f(aout,bout) return(c(aout, bout,fmin, count) ) } out- epiann(f = loglikelihood) On Mon, Dec 5, 2011 at 3:46 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: Hi all, I have the following code, When I run the code, it never terminate

Re: [R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
loop takes a long time to run. More generally, read up on the use of print() and browser() as debugging tools. Michael On Mon, Dec 5, 2011 at 3:47 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: I forgot to upload the R-code in last email, so heare is one epiann - function(T0

Re: [R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
seconds so there's no problem I can see: perhaps you want to look elsewhere to get better speed (like Rcpp or general vectorization), or maybe your loglikihood is not what's desired, but there's no problem with the loop. Michael On Mon, Dec 5, 2011 at 5:29 PM, Gyanendra Pokharel

Re: [R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
, being unprovided, I have trouble replicating. My original guess still stands: it's either 1) a case of you getting stuck at probaccept = 1 or 2) so slow it just feels endless. Either way, my prescription is the same: print() Michael On Dec 5, 2011, at 9:30 PM, Gyanendra Pokharel

Re: [R] Problem in while loop

2011-12-05 Thread Gyanendra Pokharel
I ma sorry, I miss typed the function, it should be loglikelihood instead. On Mon, Dec 5, 2011 at 10:37 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: Thanks Michael Lets figure out the problem by using the following function. I found the same problem in this code too

Re: [R] Problem in log

2011-11-30 Thread Gyanendra Pokharel
without knowing its source. Also keep in mind the limitations of floating point arithmetic if you expect alpha*d^beta to be small. Michael On Nov 29, 2011, at 6:58 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Tue, Nov 29, 2011 at 6:55 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com

[R] Problem in log

2011-11-29 Thread Gyanendra Pokharel
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]] __ R-help@r-project.org mailing list

Re: [R] Problem in log

2011-11-29 Thread Gyanendra Pokharel
when exp(-alpha*d^(-beta)) is greater than 1. How can I remove it.After generating the out put we can omit it, but the problem is different. On Tue, Nov 29, 2011 at 5:22 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: No, that,s not a problem Michael, I have following code

Re: [R] Problem in log

2011-11-29 Thread Gyanendra Pokharel
do that anywhere. What do you expect to happen? The log of a negative number IS NaN. Sarah On Tue, Nov 29, 2011 at 6:28 PM, Gyanendra Pokharel gyanendra.pokha...@gmail.com wrote: I have following code: loglikelihood - function(alpha,beta= 0.1){ loglh-0 d-0 p-0 k-NULL

[R] Dataset fit for Wavelet regression

2011-11-25 Thread Gyanendra Pokharel
Hi all, Can any body suggest me the data set which has the length of power of two and fit for the wavelet smoothing for the regression? There are alot of datasets like ethanol in the package SemiPar that can be used for this smoothing but we have to extend them in the power of two. I have no idea

[R] number of items to replace is not a multiple of replacement length

2011-11-18 Thread Gyanendra Pokharel
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

[R] Permutations

2011-11-18 Thread Gyanendra Pokharel
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]] __ R-help@r-project.org

[R] Permutation matrix

2011-11-18 Thread Gyanendra Pokharel
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

[R] Error in random walk Metroplis-hasting

2011-11-16 Thread Gyanendra Pokharel
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 -

[R] Help

2011-11-15 Thread Gyanendra Pokharel
Hi all, I have the mean vector mu- c(0,0) and variance sigma - c(10,10), now how to sample from the bivariate normal density in R? Can some one suggest me? I did not fine the function mvdnorm in R. Best Gyan [[alternative HTML version deleted]]

[R] Random-walk Metropolis-Hasting

2011-11-11 Thread Gyanendra Pokharel
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 -

[R] Gibbs sampler

2011-11-10 Thread Gyanendra Pokharel
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])

[R] Error in drawing

2011-11-09 Thread Gyanendra Pokharel
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

[R] GAM

2011-11-08 Thread Gyanendra Pokharel
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) ~

[R] Correction in error

2011-11-07 Thread Gyanendra Pokharel
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