From 0a1ab789c6738404d2606f78374510eab52b213e Mon Sep 17 00:00:00 2001 From: Lanfeng Pan Date: Thu, 20 Apr 2017 13:48:12 -0500 Subject: [PATCH] Array of Function needs type before square bracket --- src/bandwidth.jl | 2 +- src/regression.jl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bandwidth.jl b/src/bandwidth.jl index af4e7a8..fd7c662 100644 --- a/src/bandwidth.jl +++ b/src/bandwidth.jl @@ -312,7 +312,7 @@ function lscvlocalconstant(xdata::RealMatrix, ydata::RealVector, kernel::Array{F tmp/n end -function bwlocalconstant(xdata::RealMatrix, ydata::RealVector, kernel::Array{Function, 1} = [gaussiankernel for i in 1:size(xdata)[2]]) +function bwlocalconstant(xdata::RealMatrix, ydata::RealVector, kernel::Array{Function, 1} = Function[gaussiankernel for i in 1:size(xdata)[2]]) n, p = size(xdata) w = ones(n) h0 = zeros(p) diff --git a/src/regression.jl b/src/regression.jl index 1834118..f2262e3 100644 --- a/src/regression.jl +++ b/src/regression.jl @@ -93,8 +93,8 @@ end # #multi-variate nadaraya-watson regression or local linear -function localconstant(xdata::RealMatrix, ydata::RealVector; kernel::Array{Function, 1}=[gaussiankernel for i in 1:size(xdata)[2]], xeval::RealMatrix=xdata, h::RealVector=bwlocalconstant(xdata, ydata, kernel)) - +function localconstant(xdata::RealMatrix, ydata::RealVector; kernel::Array{Function, 1}=Function[gaussiankernel for i in 1:size(xdata)[2]], xeval::RealMatrix=xdata, h::RealVector=bwlocalconstant(xdata, ydata, kernel)) + m, p = size(xeval) n, p1 = size(xdata) if p1 != p || length(h) !=p @@ -104,7 +104,7 @@ function localconstant(xdata::RealMatrix, ydata::RealVector; kernel::Array{Funct error("Bandwidth should be positive") end pre=zeros(m) - + for i=1:m w = ones(n) wtmp = ones(n)