similar to: help to program my function

Displaying 20 results from an estimated 2000 matches similar to: "help to program my function"

2012 Aug 07
4
Execution of a function
Hi >i have aproblem withe execution of my function >first, i wrote my function in the script of R >nom_fonction <- function(arg1[=expr1], arg2[=expr2], ...){ bloc d'instructions } > when i want to have the result i mean the laste instruction in the bloc of > instruction , i try to >wrote the name of function >source(aj.fun) Error in readLines(file, warn =
2007 Sep 12
1
Integrate() error message, I am at a loss
Hello! I have a problem with integrate() in my function nctspa(). Integrate produces an error message "evaluation of function gave a result of wrong length". I don't know what that means. Could anyone suggest me what is wrong with my function? These are the examples of function calls that work OK: nctspa(a=1:10,n=5) nctspa(a=1:10, n=5, mu=2, theta=3, renorm=0) This does not work:
2011 Feb 17
1
Integrate with an indicator function
Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <-
2012 Aug 07
6
Decimal number
HI >i have a little problem please help me to solve it >this is the code in R: >> beta0 [1] 64.90614 > beta1 [1] 17.7025 > beta [1] 17 64 >her beta<- c(beta0, beta1) thank you in advance hafida -- View this message in context: http://r.789695.n4.nabble.com/Decimal-number-tp4639428.html Sent from the R help mailing list archive at Nabble.com.
2001 Nov 05
1
Problem to transfer Splus functions
Hello I would like to transfer some Splus functions in R. But I have a problem first about this assignation in Splus : xnom <- deparse(substitute(x)) I am a bad programmer : I don't understand the R help How to modify these functions ? Thank you very much for your help Here are the four functions and a data test
2012 Aug 11
3
help counting in data
Hi >i have this data > X [1] 5.79 1579.52 2323.70 68.85 426.07 110.29 108.29 1067.60 17.05 22.66 [11] 21.02 175.88 139.07 144.12 20.46 43.40 194.90 47.30 7.74 0.40 [21] 82.85 9.88 89.29 215.10 1.75 0.79 15.93 3.91 0.27 0.69 [31] 100.58 27.80 13.95 53.24 0.96 4.15 0.19 0.78 8.01 31.75 [41] 7.35 6.50
2000 Feb 28
1
sub in boxplot doesn't do subtiles
R list- Under Windows 2000 and r 99: I wanted a subtitle in boxplot and tried: > boxplot((AU[ROCK==2 & AU>-1]+0.1~iz),log="y",main="Boxplot of AU by 25 M elevations",sub="aa") And I got: Error in sort(x) : only vectors can be sorted In addition: Warning messages: 1: is.na() applied to non-(list or vector) in: is.na(x) 2: is.na() applied to non-(list
2005 Feb 25
1
anova grouping of factors in lme4 / lmer
Hi. I'm using lmer() from the lme4 package (version 0.8-3) and I can't get anova() to group variables properly. I'm fitting the mixed model Response ~ Weight + Experimenter + (1|SUBJECT.NAME) + (1|Date.StudyDay) where Weight is numeric and Experimenter is a factor, ie, > str(data.df) `data.frame': 4266 obs. of 5 variables: $ SUBJECT.NAME : Factor w/ 2133 levels
2009 Mar 16
1
Uniroot and Newton-Raphson Anomaly
I have the following function for which I need to find the root of a: f <- function(R,a,c,q) sum((1 - (1-R)^a)^(1/a)) - c * q To give context for the problem, this is a psychometric issue where R is a vector denoting the percentage of students scoring correct on test item i in class j, c is the proportion correct on the test by student k, and q is the number of items on the test in total. I
2001 Aug 30
1
MCMC coding problem
Dear All, I am trying to convert some S-plus code that I have to run MCMC into R-code. The program works in S-plus, but runs slowly. I have managed to source the program into R. R recognizes that the program is there; for example, it will display the code when I type the function name at the prompt. However, the program will not run. When I try to run the program, I get the following error
2006 Sep 27
1
Testing the equality of correlations
Dear All, I wonder if there is any implemented statistical test in R to test the equality between many correlations. As an example, let X1, X2, X3 X4 be four random variables. let Phi(X1,X2) , Phi(X1,X3) and Phi(X1,X4) be the corresponding correlations. How to test Phi(X1,X2) = Phi(X1,X3) = P(X1,X4)? Many thanks in advance, Bernard
2012 Aug 06
5
program of matrix
Hi can ANY body help me to programme this formula: c[lj] and c[l'j] are matrix A[j]^-1 is an invertible diagonal matrix g[ll']=i[ll'] - sum *#from j=1 to k#* c[lj]c[l'j]A[j]^-1 WHERE i[ll']= 1/n sum from i=1 to n z[il] z[il'] n,k,m are given. j=1...k, l,l'=1...m, it s complicate for me ; hope you can help me thank you a lot -- View this
2011 Jun 20
3
Unreasonable syntax error
http://r.789695.n4.nabble.com/file/n3612530/PSC.r PSC.r Hi all, I just wrote a program in R by editing it in Microsoft Word and then pasting into the text editor of R. The above is the file. And below is what the console complains.... Why doesn't it recognise 'r'?? I have to mention that at least when I typed this first several lines into the console, the first error didn't
2011 Feb 17
1
Integration with an Indicator Function in R
Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <-
2006 Jul 20
2
Timing benefits of mapply() vs. for loop was: Wrap a loop inside a function
List: Thank you for the replies to my post yesterday. Gabor and Phil also gave useful replies on how to improve the function by relying on mapply rather than the explicit for loop. In general, I try and use the family of apply functions rather than the looping constructs such as for, while etc as a matter of practice. However, it seems the mapply function in this case is slower (in terms of CPU
2005 Aug 12
8
Incompatible destination (88) Error Message
I have connected asterisk 1.0.7 with Avaya Definity via E1 with a TE100P Digium Card. Inbound calls are working perfectly and I dont have any problem. But when I try to make an outgoing call with my softphone (xlite) I am getting the following messages. Hungup 'Zap/13-1' Executing Dial("SIP/IZ-bc0a", "Zap/g1/3118") in new stack Called g1/3118 Channel 0/1, span 1 got
2012 Apr 13
2
Can't read a binary file
Hi, I've read up on readBin() and chapter 6 in the R Data Import/Export manual, but I still can't read a binary file. Here is how the creator of the file described the code that would be needed in Fortran: "Every record has a return in fortran. The length of each record is nx*ny*4. To read you would use the following: nlayx = nx*ny*4 do iz=1,nz,4 read(binary file) var(1:nlayx)
2010 Apr 01
1
centos + ldap + syncrepl (push vs pull)
Hi, From what I gather, OpenLDAP on Centos 5.x pulls LDAP changes from central LDAP server to a secondary LDAP server. So in other words, you can have your second LDAP server pull the db based on either; type=refreshOnly which mean the pull interval will happen when ever you specify or; type=refreshAndPersist which mean after a pull, keep the pipe open for any changes made. Now in
2013 Feb 21
5
BTRFS fails defragging
Hi folks, I''m using Ubuntu 12.10 Quantal with # uname -r 3.5.0-24-generic And it seems I cannot defrag : # filefrag /boot/initrd.img-3.5.0-24-generic /boot/initrd.img-3.5.0-24-generic: 3 extents found # btrfs filesystem defrag /boot/initrd.img-3.5.0-24-generic # echo $? 20 # filefrag /boot/initrd.img-3.5.0-24-generic /boot/initrd.img-3.5.0-24-generic: 3 extents found Any clue
2007 Sep 12
0
Problem with integrate()
Hello! I have a problem with integrate() in my function nctspa(). Integrate produces an error message "evaluation of function gave a result of wrong length". I don't know what that means. Could anyone suggest me what is wrong with my function? These are the examples of function calls that work OK: nctspa(a=1:10,n=5) nctspa(a=1:10, n=5, mu=2, theta=3, renorm=0) This does not work: