Re: [R] The code itself disappears after starting to execute the for loop

2016-11-23 Thread Maram SAlem
Thanks a lot Bert , will check out your suggestions. I've unchecked the buffer output option in GUI but still have the same problem. Thanks for your time and concern. Maram Salem Sent from my iPhone > On Nov 23, 2016, at 5:55 PM, Bert Gunter wrote: > > In addition to Jim

Re: [R] The code itself disappears after starting to execute the for loop

2016-11-22 Thread Maram SAlem
d the console turns white and the cursor turns blue ( busy) and I know nothing about the progress of the running code. I just want to see the bar and the output of the print function as I used to, any help? Thanks in advance. Maram Salem Sent from my iPhone > On Nov 3, 2016, at 8:30

[R] The code itself disappears after starting to execute the for loop

2016-11-03 Thread Maram SAlem
Hi all, I've a question concerning the R 3.3.1 version. I have a long code that I used to run on versions earlier to the 3.3.1 version, and when I copied the code to the R console, I can still see the code while the loop is executing , along with the output printed after each iteration of the l

Re: [R] NaNs produced as a returned value for a function

2016-02-16 Thread Maram SAlem
E needed Although both y and accept.prob have values and are not missing. Any help would be appreciated as this error is causing my entire(large and complicated) code to stop execution. Maram Salem On 14 February 2016 at 22:08, William Dunlap wrote: > You can do things like >whil

[R] NaNs produced as a returned value for a function

2016-02-14 Thread Maram SAlem
it to ignore the NaNs produced and repeat the evaluation again till it prroduces a number? Thanks in advance, Maram Salem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.c

Re: [R] missing value where TRUE/FALSE needed ERROR

2016-02-09 Thread Maram SAlem
only > if (runif(1) <= accept.prob) beta.cand else beta.curr > something is missing here. Why you take only runif(1). > > Regards > > On 9 February 2016 at 16:01, Maram SAlem > wrote: > >> Hi all, >> >> I'm trying to write a function to implement a

[R] missing value where TRUE/FALSE needed ERROR

2016-02-09 Thread Maram SAlem
dition: Warning message: In rgamma(1, shape = m + hyp[1] + hyp[3], rate = sh) : NAs produced I ran the code several times for only one iteration but everything was fine with no errors or warnings, so I don't know from where does the missing value/ NA come from? In addition, I want to calcu

[R] Metropolis-within-Gibbs algorithm

2016-02-04 Thread Maram SAlem
nction that performs what I want. So is there any other packages that you recommend or do I have to write my own functions? Thanks for helping, Maram Salem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBS

Re: [R] Alternatives for explicit for() loops

2015-11-08 Thread Maram SAlem
p. Thanks in advance. Maram Salem On 6 November 2015 at 16:54, jim holtman wrote: > If you have code that is running for a long time, then take a small case > that only runs for 5-10 minutes and turn on the RProfiler so that you can > see where you are spending your time. In most cases,

Re: [R] Alternatives for explicit for() loops

2015-11-04 Thread Maram SAlem
<-gil*(sum(hlm)+1) return (shl) } store1[j]<-incomb(x,alpha=0.2,beta=2) } val1<- sum(store1)*e return(val1) } va<-pbapply(s,1,simpfun,n=6,m=4,p=0.3,alpha=0.2,beta=2) EXP<-sum(va) Any help would be greatly appreciated. Thanks a lot for your tim

[R] Alternatives for explicit for() loops

2015-11-01 Thread Maram SAlem
.2,beta=2) } I'm trying to use alternatives (for ex. to vectorize things) to the explicit for() loops, but things don't work out. Any suggestions that can help me to speed up the execution of the incomb() function are much appreciated. Thanks a lot in advance. Maram Salem [[a

Re: [R] Time it takes to run a code

2015-10-27 Thread Maram SAlem
Thanks for helping Boris. Regards, Maram Salem On 25 October 2015 at 23:30, Boris Steipe wrote: > It may be useful for you to estimate the time complexity of your function: > try it with smaller input that takes short and noticeable time, see whether > the time increases

[R] Time it takes to run a code

2015-10-25 Thread Maram SAlem
d reach an ouput but before running the code and not after it is run? I've tried Sys.time() and system.time(), but still the console freezed for so long and I didn't reach anything. Any suggestions are much appreciated. Thanks in advance. Maram Salem [[alternative

Re: [R] Avoiding for loops

2015-10-25 Thread Maram SAlem
Thanks a lot Boris and Berend. I'll consider the brackets ((m-1) in every loop). In addition, I'll read more on profiling my code. In fact,I'm using the apply () in another part of my code. Thanks again for helping. Maram Salem On 25 October 2015 at 14:26, Berend Hasselman wrot

[R] Avoiding for loops

2015-10-25 Thread Maram SAlem
-(sum(LED[j,1:i])) + i } I appreciate if anyone has any suggestions or references. Thanks in advance. Maram Salem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.c

Re: [R] Error in rep.int() invalid 'times' value

2015-10-20 Thread Maram SAlem
Yes Indeed William. f1() works perfectly well and took only 30 secs to execute f1(25,15), but I wonder if there is anyway to speed up the execution of the rest of my code (almost seven hours now) ? Thanks for helping. Maram Salem On 20 October 2015 at 18:11, William Dunlap wrote: > f0

Re: [R] Error in rep.int() invalid 'times' value

2015-10-20 Thread Maram SAlem
} val1<- sum(store1)*e return(val1) } va<-apply(s,1,simpfun,n=25,m=15,p=0.3,alpha=0.2,beta=2) EXP<-sum(va) I don't know if something is wrong or this is normal, but I've used R before with looping codes but it never took too long. Any suggestions please? Thanks in

Re: [R] Error in rep.int() invalid 'times' value

2015-10-20 Thread Maram SAlem
Thanks for the hint Petr. I'm just a little bit confused with the function f1(). could you please help me and insert comments within f1() to be able to relate it with f0()? Thanks a lot. Maram Salem On 20 October 2015 at 11:29, PIKAL Petr wrote: > Hi > > What about using the s

Re: [R] Error in rep.int() invalid 'times' value

2015-10-20 Thread Maram SAlem
t(rep.fac, nx)), orep) : NAs introduced by coercion to integer range I don't know if this is related to the memory limits of my laptop, or it doesn't have to do with the memory. Any help on how to fix this error will be greatly appreciated. Thanks All. Maram Salem On 15 October 2015

[R] Error in rep.int() invalid 'times' value

2015-10-15 Thread Maram SAlem
)), orep) : NAs introduced by coercion to integer range Any help or suggestions will be greatly appreciated. Thanks, Maram Salem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https:

Re: [R] using the apply() family to evaluate nested functions with common arguments

2015-10-13 Thread Maram SAlem
I'm sorry, I forgot to mention that in the last step I have to use the choose() function for all the elements of x not only x[1],x[2], and x[3]. Any suggestions or recommendation for some reference or a package that can help me sort that out. Thanks. Maram Salem On 11 October 2015 at

[R] using the apply() family to evaluate nested functions with common arguments

2015-10-11 Thread Maram SAlem
er rows of s. I can't figure out how to do this while still having the rows of s, say x, as one of the arguments of the incomb() function for which I'm going to use the apply() function once more. I'm sorry if what I'm asking for is not that clear, but I'm trying to sim

Re: [R] error with seq() used in for loop

2015-10-11 Thread Maram SAlem
I got you Berend. Thanks again On 11 October 2015 at 14:20, Berend Hasselman wrote: > > > On 11 Oct 2015, at 14:12, Maram SAlem wrote: > > > > Thanks a lot for your help and patience Duncan. > > It seems that my questions is really a trivial one but I never realized

Re: [R] error with seq() used in for loop

2015-10-11 Thread Maram SAlem
Thanks Berend On 11 October 2015 at 14:10, Berend Hasselman wrote: > > > On 11 Oct 2015, at 13:52, Maram SAlem wrote: > > > > Dear All, > > I have a question concerning the seq() function arguments when used in a > > for() loop. > > I'll simplify th

Re: [R] error with seq() used in for loop

2015-10-11 Thread Maram SAlem
Thanks a lot for your help and patience Duncan. It seems that my questions is really a trivial one but I never realized that 1:4 means 0 1 2 3 4 , never knew it starts from 0. On 11 October 2015 at 14:07, Duncan Murdoch wrote: > On 11/10/2015 7:52 AM, Maram SAlem wrote: > > Dear A

[R] error with seq() used in for loop

2015-10-11 Thread Maram SAlem
Dear All, I have a question concerning the seq() function arguments when used in a for() loop. I'll simplify this question to make it more clear. Suppose I have a (5*3)matrix s (for ex.) and I need to write a function with for() loop, in each step of the loop I need to generate a sequence whose up

Re: [R] (subscript) logical subscript too long

2015-10-01 Thread Maram SAlem
emory-it-uses_0021 > > > > > > starts by: > > > > memory.limit(size=1920) > > > > and try increasing value of size as a parameter for memory.limit(). > > > > > > I use Intel i5 Windows-7 64-bit 16GB RAM. > > > > > > GG &g

Re: [R] (subscript) logical subscript too long

2015-10-01 Thread Maram SAlem
ites to be able to execute my code?? I'm currently using intel core i3, windows 7 Thanks for helping. Maram On 1 October 2015 at 13:37, Giorgio Garziano wrote: > Check your memory size by: > > > > memory.limit() > > > > try to increase it by: > > > >

Re: [R] (subscript) logical subscript too long

2015-10-01 Thread Maram SAlem
Thanks Giorgio, I got it. I managed to reach the matrix s whose rows represent all the possible combinations. Here is the code: > n=12 > m=7 > D<-matrix(0,nrow=n-m+1,ncol=m-1) > for (i in 1:m-1) + { + D[,i]<-seq(0,n-m,1) + } > ED <- do.call(`expand.grid`,as.data.frame(D)) > ED<-as.matrix(ED)

[R] (subscript) logical subscript too long

2015-09-30 Thread Maram SAlem
Dear All, I'm trying to write a function in the values of some numeric vectors (d1,d2,...,d(m-1)). This function should be applied on some combinations of the elements of the (m-1) d vectors that satisfy the condition of having a sum less than or equal to (n-m). I've tried the following code, but

Re: [R] writing an equation with multiple summation

2015-09-29 Thread Maram SAlem
My first problem is that the counters involved in the summation are dependent, For instance for each r[i], 0 wrote: > Dear All, > > I'm trying to write and evaluate an equation which involves multiple > summations but can't figure out how to do it. > > I've an numeric vector r > r<-vector(mode = "

[R] writing an equation with multiple summation

2015-09-28 Thread Maram SAlem
Dear All, I'm trying to write and evaluate an equation which involves multiple summations but can't figure out how to do it. I've an numeric vector r r<-vector(mode = "numeric", length = m) and I have multiple summations (for ex.) of the form: [(sum from r[1]=0 to g(r[1])) (sum from r[2] =0 to

[R] Generating Progressively censored samples

2015-07-27 Thread Maram SAlem
Dear All, Is there some built-in function in R that can be used to generate progressively censored sample from a certain distribution, for example, the Weibull distribution? OR Do I have to write the code of the algorithm myself? Thanks for helping. Maram Salem [[alternative HTML

Re: [R] Warning message with maxLik()

2015-07-21 Thread Maram SAlem
ot; > are always positive. > > [1] > http://r.789695.n4.nabble.com/NaN-produced-from-log-with-positive-input-td4709463.html > > Best regards, > Arne > > > > 2015-07-18 2:46 GMT+02:00 Maram SAlem : > > Dear All, > > I'm trying to get the MLe for a c

Re: [R] Warning message with maxLik()

2015-07-19 Thread Maram SAlem
ays positive. > > [1] > http://r.789695.n4.nabble.com/NaN-produced-from-log-with-positive-input-td4709463.html > > Best regards, > Arne > > > > 2015-07-18 2:46 GMT+02:00 Maram SAlem : > > Dear All, > > I'm trying to get the MLe for a certain distributi

[R] Warning message with maxLik()

2015-07-17 Thread Maram SAlem
.66) and not (NAN). I've also tried to: 1- Reparamtrize my model using lamda(i)= log(theta(i)), for i=1,2,3, so that it may solve the problem, but it didn't. 2- I've used the comparederivitive() function, and the analytic and numeric gradients were so close. Any help please? Maram Sale

Re: [R] NaN produced from log() with positive input

2015-07-12 Thread Maram Salem
Dear Arne, Will do. Thanks for helping. Maram Sent from my iPhone > On Jul 12, 2015, at 8:23 AM, Arne Henningsen > wrote: > > Dear Maram > >> On 8 July 2015 at 17:52, Maram Salem wrote: >> Dear Arne, >> >> On a second thought, as per your mail "t

Re: [R] Can't post to the list

2015-07-09 Thread Maram Salem
Dear Rolf, There isn't any offending content. I think it's related to the styles used on the mail. Thanks for helping. Maram Sent from my iPhone > On Jul 9, 2015, at 11:36 AM, Rolf Turner wrote: > > >> On 09/07/15 19:49, Maram Salem wrote: >> >> Sorry I

Re: [R] Can't post to the list

2015-07-09 Thread Maram Salem
Thanks a lot John. Will check it out. Maram Sent from my iPhone On Jul 9, 2015, at 1:17 PM, John McKown wrote: >> >> On Thu, Jul 9, 2015 at 6:04 AM, Maram Salem wrote: >> > >> > Dear Rolf, >> > I recieved this message exactly: >> > "

Re: [R] Can't post to the list

2015-07-09 Thread Maram Salem
Dear Rolf, I recieved this message exactly: "The message's content type was not explicitly allowed" Thanks for your concern, Maram Sent from my iPhone > On Jul 9, 2015, at 11:36 AM, Rolf Turner wrote: > > >> On 09/07/15 19:49, Maram Salem wrote: >> &g

Re: [R] Can't post to the list

2015-07-09 Thread Maram Salem
Sorry I mean NOT explicitly allowed Sent from my iPhone > On Jul 9, 2015, at 8:46 AM, Maram Salem wrote: > > Dear all, > I need help with posting to the list. Whenever i post any message, i get this > reply : the message content was explicitly allowed. > Any help pleas

[R] Can't post to the list

2015-07-08 Thread Maram Salem
Dear all, I need help with posting to the list. Whenever i post any message, i get this reply : the message content was explicitly allowed. Any help please? Thanks a lot. Maram Sent from my iPhone __ R-help@r-project.org mailing list -- To UNSUBSCRIB

Re: [R] NaN produced from log() with positive input

2015-07-07 Thread Maram Salem
am' consists of log( theta[1] ), log( theta[2] ), > and log( theta[3] ). After the estimation, you can obtain the > estimated values of the thetas by exp( param[1] ), exp( param[2] ), > and exp( param[3] ) . > > Best regards, > Arne > > > > 2015-07-06 2:29 G

[R] Can't get a reasonable the maximum likelihood estimator

2015-07-07 Thread Maram Salem
Sent from my iPhone Begin forwarded message: > From: "Maram Salem" > Date: July 6, 2015 at 2:29:56 AM GMT+2 > To: "r-help@r-project.org" > Subject: [R] NaN produced from log() with positive input > > Dear All > I'm trying to find

[R] NaN produced from log() with positive input

2015-07-06 Thread Maram Salem
Dear All I'm trying to find the maximum likelihood estimator of a certain distribution based on the newton raphson method using maxLik package. I wrote the log-likelihood , gradient, and hessian functionsusing the following code. #Step 1: Creating the theta vector theta <-vector(mode = "numer

[R] histogram scott

2010-02-05 Thread maram salem
Dear all, I want to use the histogtam as a density estimator, with the binwidths calculated using scott's formula which is binwidth = 3.49*ST.dev.*n^(-1/3) for the following data  (30 data points) 12-9-3-6-1-23-21-7-18-16-15-4-19-22-20-2-3-18-8-10-1-7-5-4-11-12-3-9-19-7 so first,I' ve tried this

[R] Fw: solving a linear equation

2009-11-04 Thread maram salem
Sorry, I didn't mean a linear equation, of course this equation is not linear, I meant an equation in one unknown. Hi all, I've a linear equation of the form: 0.95=2 ( [3+ln(x/3)]^-13  + 4 [3+2ln(x/3)]^-13  + [3+4ln(x/3)]^-13 ) and I want to solve it for x, can I do this using R? Thanks in ad

[R] solving a linear equation

2009-11-04 Thread maram salem
Hi all, I've a linear equation of the form: 0.95=2 ( [3+ln(x/3)]^-13  + 4 [3+2ln(x/3)]^-13  + [3+4ln(x/3)]^-13 ) and I want to solve it for x, can I do this using R? Thanks in advance. Maram. [[alternative HTML version deleted]] __ R-h

[R] axis label

2009-10-14 Thread maram salem
Hi all, I want the y-axis label to be ( in symbols) g(sigma given alpha) where given is the conditional sign. I've tried ylab=expression(g(sigma|alpha))) but it gave me g(|(sigma,alpha)) where the sigma and alpha are in greek but the conditional sign is misplaced (before the bracket) Any help woul

[R] cdf

2009-10-13 Thread maram salem
Dear all, I have the cdf of the following power fuction distribution: F(y)=(y/350)^a   ,00. I want to use it as the argument of the discretize function of the actuar package. So I think I need to define this function to R so that if I entered a=1, I get the following F(y)=(y/350) and

[R] finding the minimum value

2009-09-07 Thread maram salem
Hi all, I'm using a certain  procedure to calculate the value of some variable(Bayes risk),B. So I got the values B1, B2, , B1000, each under certain input values and using a long procedure. Now, I want to put the values I got in a nummerical vector and find their minimum value. I think

[R] using histogram to find cdf

2009-09-06 Thread maram salem
Dear all, How can I use the histogram density estimate (hist) to find the value of the cdf at a certain point? Thanks Maram [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

[R] converting a matrix into a fn

2009-08-25 Thread maram salem
Dear All, I have a matrix m of the form  m     [,1] [,2]   [1,]  9072.302 0.0004462366   [2,]  9086.811 0.0005628169   [3,]  9101.320 0.0007126347   [4,]  9115.830 0.0008986976   [5,]  9130.339 0.001126   [6,]  9144.848 0.0014018405   [7,]  9159.357 0

[R] calculating probability

2009-08-24 Thread maram salem
Hi all, I've a trivial question. If (q) is a continous variable,actually a vector of 1000 values. how to calculate the probability that q is greater than a specific value, i.e. P(q>45)?? Thanks Maram [[alternative HTML version deleted]] __

[R] kernel density estimates

2009-08-22 Thread maram salem
Dear All, I have a variable q which is a vector of 1000 simulated positive values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in the sample observations), and thus I was left with 1000 values of q and I don't know th

[R] Fw: Hist & kernel density estimates

2009-08-20 Thread maram salem
Dear All, Here are the codes of a histogram & a kernel density estimates that I used. For the hist estimate >par(mex=1.3) >dens<-density(q) >options(scipen=4) > ylim<-range(dens$y) > h<-hist(q,breaks="scott",freq=FALSE,probability=TRUE, +  right=FALSE,xlim=c(9000,16000),ylim=ylim,main="Histogram o

[R] Fw: Hist & kernel density estimates

2009-08-19 Thread maram salem
For the hist estimate >par(mex=1.3) >dens<-density(q) >options(scipen=4) > ylim<-range(dens$y) > h<-hist(q,breaks="scott",freq=FALSE,probability=TRUE, +  right=FALSE,xlim=c(9000,16000),ylim=ylim,main="Histogram of q(scott)") > lines(dens) >box()   For the kernel estimate>options(scipen=4) > d <-

[R] Hist & kernel density estimates

2009-08-19 Thread maram salem
Dear All, Attached are the codes of a histogram & a kernel density estimate and the output they produced. In fact the variable q is a vector of 1000 simulated values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in th

[R] axis scale

2009-08-12 Thread maram salem
Dear All, I'm trying to plot a histogram (with the relative frequencies as the Y axis), But the scale of the y axis is given by 0e+00, 1e-04, 2e-04, 3e-04,. Now, I have 2 questions 1- Does (1e-04=0.01831563)? 2- If this true,how can i change the given scale to (0.01,0.03,0.05,0.07,0.09)?

[R] Fw: (no subject)

2009-07-12 Thread maram salem
Dear group, Thank u so much 4 ur help. I've tried the link, http://finzi.psych.upenn.edu/R/library/quantreg/html/akj.html for adaptive kernel density estimation. But since I'm an R beginer and the topic of adaptive estimation is new for me, i still can't figure out some of the arguments of ak

[R] (no subject)

2009-06-30 Thread maram salem
Hi Group, I've a vector of 1000 numeric values for which I want to draw a histogram. I've read this vector into R with no variable name.I mean only the 1000 values, which makes V1 the name of the variable by default?? Then I tried > hist(V1, breaks = "Sturges", +  freq = NULL, probability =

[R] Help

2009-06-29 Thread maram salem
Hi group, I found a module for adaptive kernel density estimation for Stata users, but unfortunetly I don't have access to Stata, can I find a similar approach using R? Thank u so much 4 ur time. [[alternative HTML version deleted]] _

[R] (no subject)

2009-06-29 Thread maram salem
Hi group, I found a module for adaptive kernel density estimation for Stata users, but unfortunetly I don't have access to Stata, can I find a similar approach using R? [[alternative HTML version deleted]] __ R-help@r-project.org maili