Skip to content

Commit

Permalink
Fix more 0.6 depwarns (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored Mar 11, 2017
1 parent 19821b9 commit 19503c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/statsmodels/formula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function allvars(ex::Expr)
end
allvars(f::Formula) = unique(vcat(allvars(f.rhs), allvars(f.lhs)))
allvars(sym::Symbol) = [sym]
allvars(v::Any) = Array(Symbol, 0)
allvars(v::Any) = Vector{Symbol}(0)

# special operators in formulas
const specials = Set([:+, :-, :*, :/, :&, :|, :^])
Expand Down Expand Up @@ -208,9 +208,9 @@ evt(a) = Any[a]
function Terms(f::Formula)
rhs = condense(distribute(dospecials(f.rhs)))
tt = unique(getterms(rhs))
tt = tt[!(tt .== 1)] # drop any explicit 1's
tt = tt[(!).(tt .== 1)] # drop any explicit 1's
noint = (tt .== 0) .| (tt .== -1) # should also handle :(-(expr,1))
tt = tt[!noint]
tt = tt[(!).(noint)]
oo = Int[ord(t) for t in tt] # orders of interaction terms
if !issorted(oo) # sort terms by increasing order
pp = sortperm(oo)
Expand All @@ -232,7 +232,7 @@ end

## Default NA handler. Others can be added as keyword arguments
function na_omit(df::DataFrame)
cc = complete_cases(df)
cc = completecases(df)
df[cc,:], cc
end

Expand Down Expand Up @@ -415,7 +415,7 @@ function droprandomeffects(trms::Terms)
if !any(retrms) # return trms unchanged
trms
elseif all(retrms) && !trms.response # return an empty Terms object
Terms(Any[],Any[],Array(Bool, (0,0)),Array(Bool, (0,0)), Int[], false, trms.intercept)
Terms(Any[],Any[],Matrix{Bool}(0,0),Matrix{Bool}(0,0), Int[], false, trms.intercept)
else
# the rows of `trms.factors` correspond to `eterms`, the columns to `terms`
# After dropping random-effects terms we drop any eterms whose rows are all false
Expand Down
2 changes: 1 addition & 1 deletion src/statsmodels/statsmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ for (modeltype, dfmodeltype) in ((:StatisticalModel, DataFrameStatisticalModel),
end

# Delegate functions from StatsBase that use our new types
typealias DataFrameModels Union{DataFrameStatisticalModel, DataFrameRegressionModel}
const DataFrameModels = Union{DataFrameStatisticalModel, DataFrameRegressionModel}
@delegate DataFrameModels.model [StatsBase.coef, StatsBase.confint,
StatsBase.deviance, StatsBase.nulldeviance,
StatsBase.loglikelihood, StatsBase.nullloglikelihood,
Expand Down
2 changes: 1 addition & 1 deletion test/formula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ module TestFormula
d[:x1m] = @data [5, 6, NA, 7]
mf = ModelFrame(@formula(y ~ x1m), d)
mm = ModelMatrix(mf)
@test mm.m[:, 2] == d[complete_cases(d), :x1m]
@test mm.m[:, 2] == d[completecases(d), :x1m]
@test mm.m == ModelMatrix{sparsetype}(mf).m

## Same variable on left and right side
Expand Down

0 comments on commit 19503c1

Please sign in to comment.