(no subject)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

R help mailing list-2
hellothis is my programmeyou can help me, i cann't found a solution for H  and this  function i calculate for all value for x1thank you


x<-rexp(N,2)

z<-rnorm(0,1,n)

g<rexp(2,n)

h=max(x)-min(x)

n1=n^0.17

h1=h/n1

k=2

x1<-seq(from=-2,to=2,by=0.1)

s[i]=(x[i]+x[i+1])/2

for(i in 1:N)

fkS<-function(m,k){fkm=-m*(abs(Z-m)<k)+k*(Z-m>=k)-k*(Z-m<=-k)}

k1<-function(u,x1){-1/(2*pi)exp((x1-u)/h1}

for (i in 1:n)

{k1(u,x1)=integrate(-1/(2*pi)exp((x1-u)/h1,lower=s[i-1],upper=s[i])}

 

 

H<-function(u,x1)

for (i in 1:n)

{H(u,x1)=sum(g[i]*fkS*integrate(k1,lower=s[i-1],upper=s[i])

}


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Jim Lemon-4
Hi malika,
You don't seem to have defined your functions correctly. For example:

H<-function(u,x1)

would define an empty function H if that command worked, but it doesn't

Jim


On Tue, Aug 7, 2018 at 3:51 PM, malika yassa via R-help
<[hidden email]> wrote:

> hellothis is my programmeyou can help me, i cann't found a solution for H  and this  function i calculate for all value for x1thank you
>
>
> x<-rexp(N,2)
>
> z<-rnorm(0,1,n)
>
> g<rexp(2,n)
>
> h=max(x)-min(x)
>
> n1=n^0.17
>
> h1=h/n1
>
> k=2
>
> x1<-seq(from=-2,to=2,by=0.1)
>
> s[i]=(x[i]+x[i+1])/2
>
> for(i in 1:N)
>
> fkS<-function(m,k){fkm=-m*(abs(Z-m)<k)+k*(Z-m>=k)-k*(Z-m<=-k)}
>
> k1<-function(u,x1){-1/(2*pi)exp((x1-u)/h1}
>
> for (i in 1:n)
>
> {k1(u,x1)=integrate(-1/(2*pi)exp((x1-u)/h1,lower=s[i-1],upper=s[i])}
>
>
>
>
>
> H<-function(u,x1)
>
> for (i in 1:n)
>
> {H(u,x1)=sum(g[i]*fkS*integrate(k1,lower=s[i-1],upper=s[i])
>
> }
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.