Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: question
Replies: 0

 Hagwood, Charles R. Posts: 12 Registered: 12/31/09
question
Posted: May 6, 2013 2:25 AM

I have the following data:

data= {36.14,38.41,59.97,61.36,73.91,75.07,80.69,103.84,116.68,118.99,119.42,121.23,128.56,184.84,188.88,189.15,199.43,220.23,225.84,226.56,233.48,237.81,237.85,237.87,239.21,239.81,241.04,241.12,250.69,255.49,256.13,256.63,257.66,258.53,259.33,259.33,268.7,274.11,278.21,278.71,279.15,299.44,299.77,300.34,302.24,309.42,309.58,309.98,310.01,311.45,313.55,313.85,332.07,333.31,334.4,359.03,359.07,367.57}

Since SmoothKernelDistribution is very slow I amusing this modification

k1[x1_,data1_,type1_]:=Module[{f,g,p,atoms,collection,x,h1,iq,denom,z,y},

iq=Quantile[data1,.75]-Quantile[data1,.25];

h1=0.9*Min[StandardDeviation[data1],iq/1.34]/Length[data1]^(1/5);

f[x_,y_,h_,type_]:=Which[type=D0"Gaussian kernel",1/(h [cid:image001.png@01CE48DC.85F2A600] ) Exp[-((x-y)2/(2h2))],type=D0"triangular kernel",If[-1=A3((x-y)/h)=A31,1/h (1-Abs[(x-y)/h]),0],type=D0"uniform kernel",If[-1=A3((x-y)/h)=A31,1/(2h),0],type=D0"Epanechnikov kernel",If[-1=A3(x-y)/h=A31,1/h3/4 (1-((x-y)/h)2),0],type=D0"quartic kernel",If[-1=A3(x-y)/h=A31,1/h 15/16 (1-((x-y)/h)^2)2,0],type=D0"triweight kernel",If[-1=A3(x-y)/h=A31,1/h 35/32 (1-((x-y)/h)^2)3,0],type=D0"cosine kernel",If[-1=A3(x-y)/h=A31,1/h p/4 Cos[p/2 ((x-y)/h)],0]];

denom[z_?NumericQ]:=NIntegrate[h1^(-1)*Exp[-.5*(z-y)^2/h1^2]/Sqrt[2*Pi],{y,0,Max[data1]}]; atoms=Map[f[x1,#,h1,type1]&,data1]/denom[x1];collection=(Total@atoms)/(Length@atoms)]

nn=Length[data];

T=Max[data];

Let g[s_?NumericQ,beta_?NumericQ]:=Table[UnitStep[s-data[[i]]]*Exp[-beta*(s-data[[i]])],

{i,1,nn}];

lambda[s_?NumericQ,mu_?NumericQ,alpha_?NumericQ,beta_?NumericQ]:=mu+alpha*Apply[Plus,g[s,beta]]

obj[mu_,alpha_,beta_]:=

NIntegrate[( lambda[s,mu,alpha,beta]),{s,0,T}]

Cannot this function to work.

Any help appreciated.

Charles Hagwood
National Institute of Standards and Technology