Hello,

I want to know the function in R for these formula.

1-Σn(n-1)/N(N-1)

Can you create the function ?

greetings

Vio

Hello,

I want to know the function in R for these formula.

1-Σn(n-1)/N(N-1)

Can you create the function ?

greetings

Vio

Hallo Gueyenono,

Yes n and N differ from each other .

Greeting

Vio

You need to say what the limits of the summation are. It would also be good to show what you have tried so far.

Hallo startz,

die Formel soll angewandt werden auf Mat1

Vecmat<-seq(from=1, to=1000)

Mat1<-matrix(Vecmat, ncol = 10)

die Funktion soll divers heißen

apply(Mat1, 1, divers)

divers <- function(x){

?

D <- 1 - (sum_n(n-1)/(N * (N - 1)))

return(D)

}

assuming that the Summation is only over the numerator, and that the values of n should be from 1 to a maximum of some`n`

provided to the function, and that N is similarly a single value past into the function. then

```
somefunction <- function(n,N){
1-sum((1:n)*((1:n)-1)) / (N*(N-1))
}
#example how it might be used
somefunction(2,6)
somefunction(6,2)
```

Dankeschön,. Das hat mir schon sehr geholfen!

Wie sieht die function aus , wenn sie auf Mat1 angewandt wird?

Vecmat<-seq(from=1, to=1000)

Mat1<-matrix(Vecmat, ncol = 10)

apply(Mat1, 1, somefunction)

Vg

Vio

I'm not sure why you want to apply it this way. But note that `Mat1`

has two dimensions and `somefunction`

needs a second argument given in `apply()`

.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.