Skip to content

Commit f776585

Browse files
committed
add tests for multivariate regression
1 parent 0a1ab78 commit f776585

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/testreg.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ yfit1=npr(x, y, xeval=xeval, reg=locallinear)
2828
cb=bootstrapCB(x, y, xeval=xeval)
2929
@test mean(vec(cb[1,:]) .<= yfit1 .<= vec(cb[2,:])) > .8
3030

31-
31+
#multivariate regression
32+
x = rand(Normal(10), 500, 3)
33+
y = x * ones(3) .+ x.^2 *ones(3)
34+
yfit1 = localconstant(x, y, xeval=x)
35+
regfit = x*inv(x'*x)*x'*y
36+
@test sum(abs2, regfit .- y) > sum(abs2, yfit1.-y)
3237

3338

3439
###Bounded gamma kernel density and regression

0 commit comments

Comments
 (0)