
Advanced Statistics Advanced Probability and Statistics Math Forum 
 LinkBack  Thread Tools  Display Modes 
April 24th, 2013, 06:04 PM  #1 
Member Joined: May 2012 Posts: 56 Thanks: 0  Bootstrapping and R
I have the code: >delta<function(y,n,sigma,a,b,N){ +T<rlogis(N,a,b) +W<sqrt(n)/(sqrt(2)*pi*sigma)*exp((n*(yT)^2)(S*sigma^2)) +d<mean(T*W)/mean(T) +return(d) +} And I want to compute this M times for y=8,n=7,sigma=2,a=3,b=1,N=1000,M =10000. So this is what I wrote: >my.sample<delta(8, 7, 2,3,1,1000) +M<10000 +M;d<numeric(M) +for(i in 1:M) +d[i]=delta(y,n,sigma,a,b,N) +{ >x<sample(delta, 10000, replace=TRUE) >M;d[i]<mean(x)} But I keep getting errors, so I must be doing something wrong but I'm not sure what. In other words, this is how it looks like in R: > my.sample<delta(8, 7, 2,3,1,1000) Error in delta(8, 7, 2, 3, 1, 1000) : attempt to apply nonfunction > M<10000 > M;d<numeric(M) [1] 10000 > for(i in 1:M) + d[i]=delta(y,n,sigma,a,b,N) Error in rlogis(N, a, b) : object 'N' not found > { + x<sample(delta, 10000, replace=TRUE) + M;d[i]<mean(x)} Error in x[.Internal(sample(length(x), size, replace, prob))] : object of type 'closure' is not subsettable I've been trying to fix this for a long time, and it's really frustrating...any help would be appreciated. Thanks in advance 