Skip to content

Commit 020a0c1

Browse files
Maximilian-Stefan-Ernstalyst
authored andcommitted
Merge pull request StructuralEquationModels#192 from StructuralEquationModels/devel
Apply reformatting to main branch
2 parents 8cd36c3 + f1d0b85 commit 020a0c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3062
-2429
lines changed

.JuliaFormatter.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
always_for_in = true
2+
align_assignment = true
3+
align_struct_field = true
4+
align_conditional = true
5+
align_pair_arrow = true
6+
align_matrix = true
7+
remove_extra_newlines = true
8+
whitespace_typedefs = true

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches: '*'
55
tags: '*'
6+
pull_request:
7+
branches: '*'
68
workflow_dispatch:
79
jobs:
810
test:

.github/workflows/FormatCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Format suggestions
2+
on:
3+
pull_request_target:
4+
# this argument is not required if you don't use the `suggestion-label` input
5+
types: [ opened, reopened, synchronize, labeled, unlabeled ]
6+
jobs:
7+
code-style:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: julia-actions/julia-format@v2
11+
with:
12+
version: '1'
13+
suggestion-label: 'format-suggest'

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StructuralEquationModels"
22
uuid = "383ca8c5-e4ff-4104-b0a9-f7b279deed53"
33
authors = ["Maximilian Ernst", "Aaron Peikert"]
4-
version = "0.2.3"
4+
version = "0.2.4"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

docs/make.jl

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Documenter, StructuralEquationModels
22

33
makedocs(
4-
sitename="StructuralEquationModels.jl",
4+
sitename = "StructuralEquationModels.jl",
55
pages = [
66
"index.md",
77
"Tutorials" => [
@@ -11,67 +11,62 @@ makedocs(
1111
"tutorials/specification/specification.md",
1212
"tutorials/specification/graph_interface.md",
1313
"tutorials/specification/ram_matrices.md",
14-
"tutorials/specification/parameter_table.md"
14+
"tutorials/specification/parameter_table.md",
1515
],
1616
"Model Construction" => [
1717
"tutorials/construction/construction.md",
1818
"tutorials/construction/outer_constructor.md",
19-
"tutorials/construction/build_by_parts.md"
20-
],
21-
"Optimization Backends" => [
22-
"tutorials/backends/optim.md",
23-
"tutorials/backends/nlopt.md"
19+
"tutorials/construction/build_by_parts.md",
2420
],
21+
"Optimization Backends" =>
22+
["tutorials/backends/optim.md", "tutorials/backends/nlopt.md"],
2523
"Model Fitting" => "tutorials/fitting/fitting.md",
2624
"Model Inspection" => "tutorials/inspection/inspection.md",
2725
"Mean Structures" => "tutorials/meanstructure.md",
2826
"Collections" => [
2927
"tutorials/collection/collection.md",
30-
"tutorials/collection/multigroup.md"
28+
"tutorials/collection/multigroup.md",
3129
],
32-
"Constraints" => "tutorials/constraints/constraints.md"
30+
"Constraints" => "tutorials/constraints/constraints.md",
3331
],
3432
"Developer documentation" => [
3533
"Extending the package" => "developer/extending.md",
3634
"Custom loss functions" => "developer/loss.md",
3735
"Custom imply types" => "developer/imply.md",
3836
"Custom optimizer types" => "developer/optimizer.md",
3937
"Custom observed types" => "developer/observed.md",
40-
"Custom model types" => "developer/sem.md"
41-
],
42-
"Advanced tutorials" => [
43-
"Regularization" => "tutorials/regularization/regularization.md"
38+
"Custom model types" => "developer/sem.md",
4439
],
40+
"Advanced tutorials" =>
41+
["Regularization" => "tutorials/regularization/regularization.md"],
4542
"Performance tips" => [
4643
"Model sorting" => "performance/sorting.md",
4744
"MKL" => "performance/mkl.md",
4845
"Simulation studies" => "performance/simulation.md",
4946
"Symbolic precomputation" => "performance/symbolic.md",
5047
"Starting values" => "performance/starting_values.md",
51-
"Parametric Types" => "performance/parametric.md"
48+
"Parametric Types" => "performance/parametric.md",
5249
],
5350
"Internals and design" => [
5451
"Internals and design" => "internals/internals.md",
5552
"files" => "internals/files.md",
56-
"types" => "internals/types.md"
53+
"types" => "internals/types.md",
5754
],
58-
"Complementary material" => [
59-
"Mathematical appendix" => "complementary/maths.md"
60-
]
55+
"Complementary material" => ["Mathematical appendix" => "complementary/maths.md"],
6156
],
6257
format = Documenter.HTML(
6358
prettyurls = get(ENV, "CI", nothing) == "true",
6459
assets = ["assets/favicon_zeta.ico"],
6560
ansicolor = true,
66-
collapselevel = 1
61+
collapselevel = 1,
6762
),
68-
doctest = false
63+
doctest = false,
6964
)
7065

7166
# doctest(StructuralEquationModels, fix=true)
7267

7368
deploydocs(
7469
repo = "github.com/StructuralEquationModels/StructuralEquationModels.jl",
7570
devbranch = "devel",
76-
push_preview = "push_preview=true" ARGS
71+
push_preview = "push_preview=true" ARGS,
7772
)

src/StructuralEquationModels.jl

Lines changed: 104 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
module StructuralEquationModels
22

3-
using LinearAlgebra, Optim,
4-
NLSolversBase, Statistics, SparseArrays, Symbolics,
5-
NLopt, FiniteDiff, PrettyTables,
6-
Distributions, StenoGraphs, LazyArtifacts, DelimitedFiles,
3+
using LinearAlgebra,
4+
Optim,
5+
NLSolversBase,
6+
Statistics,
7+
StatsBase,
8+
SparseArrays,
9+
Symbolics,
10+
NLopt,
11+
FiniteDiff,
12+
PrettyTables,
13+
Distributions,
14+
StenoGraphs,
15+
LazyArtifacts,
16+
DelimitedFiles,
717
DataFrames
818

919
import DataFrames: DataFrame
1020
export StenoGraphs, @StenoGraph, meld
1121

22+
const SEM = StructuralEquationModels
23+
1224
# type hierarchy
1325
include("types.jl")
1426
include("objective_gradient_hessian.jl")
@@ -76,41 +88,91 @@ include("frontend/fit/fitmeasures/fit_measures.jl")
7688
include("frontend/fit/standard_errors/hessian.jl")
7789
include("frontend/fit/standard_errors/bootstrap.jl")
7890

79-
80-
81-
export AbstractSem,
82-
AbstractSemSingle, AbstractSemCollection, Sem, SemFiniteDiff,
83-
SemEnsemble,
84-
SemImply,
85-
RAMSymbolic, RAMSymbolicZ, RAM, ImplyEmpty, imply,
86-
start_val,
87-
start_fabin3, start_simple, start_parameter_table,
88-
SemLoss,
89-
SemLossFunction, SemML, SemFIML, em_mvn, SemLasso, SemRidge,
90-
SemConstant, SemWLS, loss,
91-
SemOptimizer,
92-
SemOptimizerEmpty, SemOptimizerOptim, SemOptimizerNLopt, NLoptConstraint,
93-
optimizer, n_iterations, convergence,
94-
SemObserved,
95-
SemObservedData, SemObservedCovariance, SemObservedMissing, observed,
96-
sem_fit,
97-
SemFit,
98-
minimum, solution,
99-
sem_summary,
100-
objective!, gradient!, hessian!, objective_gradient!, objective_hessian!,
101-
gradient_hessian!, objective_gradient_hessian!,
102-
ParameterTable,
103-
EnsembleParameterTable, update_partable!, update_estimate!, update_start!,
104-
Fixed, fixed, Start, start, Label, label,
105-
get_identifier_indices,
106-
RAMMatrices,
107-
RAMMatrices!,
108-
identifier,
109-
fit_measures,
110-
AIC, BIC, χ², df, fit_measures, minus2ll, n_par, n_obs, p_value, RMSEA, n_man,
111-
EmMVNModel,
112-
se_hessian, se_bootstrap,
113-
example_data,
114-
swap_observed, update_observed,
115-
@StenoGraph, , , ,
116-
end
91+
export AbstractSem,
92+
AbstractSemSingle,
93+
AbstractSemCollection,
94+
Sem,
95+
SemFiniteDiff,
96+
SemEnsemble,
97+
SemImply,
98+
RAMSymbolic,
99+
RAM,
100+
ImplyEmpty,
101+
imply,
102+
start_val,
103+
start_fabin3,
104+
start_simple,
105+
start_parameter_table,
106+
SemLoss,
107+
SemLossFunction,
108+
SemML,
109+
SemFIML,
110+
em_mvn,
111+
SemRidge,
112+
SemConstant,
113+
SemWLS,
114+
loss,
115+
SemOptimizer,
116+
SemOptimizerEmpty,
117+
SemOptimizerOptim,
118+
SemOptimizerNLopt,
119+
NLoptConstraint,
120+
optimizer,
121+
n_iterations,
122+
convergence,
123+
SemObserved,
124+
SemObservedData,
125+
SemObservedCovariance,
126+
SemObservedMissing,
127+
observed,
128+
sem_fit,
129+
SemFit,
130+
minimum,
131+
solution,
132+
sem_summary,
133+
objective!,
134+
gradient!,
135+
hessian!,
136+
objective_gradient!,
137+
objective_hessian!,
138+
gradient_hessian!,
139+
objective_gradient_hessian!,
140+
ParameterTable,
141+
EnsembleParameterTable,
142+
update_partable!,
143+
update_estimate!,
144+
update_start!,
145+
update_se_hessian!,
146+
Fixed,
147+
fixed,
148+
Start,
149+
start,
150+
Label,
151+
label,
152+
get_identifier_indices,
153+
RAMMatrices,
154+
identifier,
155+
fit_measures,
156+
AIC,
157+
BIC,
158+
χ²,
159+
df,
160+
fit_measures,
161+
minus2ll,
162+
n_par,
163+
n_obs,
164+
p_value,
165+
RMSEA,
166+
n_man,
167+
EmMVNModel,
168+
se_hessian,
169+
se_bootstrap,
170+
example_data,
171+
swap_observed,
172+
update_observed,
173+
@StenoGraph,
174+
,
175+
,
176+
,
177+
178+
end

src/additional_functions/artifacts.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function example_data(name)
1919
data, header = readdlm(path, ',', header = true)
2020
data_raw = DataFrame(data, vec(header))
2121
for col in eachcol(data_raw)
22-
replace!(col,"NA" => missing)
22+
replace!(col, "NA" => missing)
2323
end
2424
data = identity.(data_raw)
2525
return data
@@ -31,11 +31,11 @@ function example_data(name)
3131
data, header = readdlm(path, ',', header = true)
3232
data_raw = DataFrame(data, vec(header))
3333
for col in eachcol(data_raw)
34-
replace!(col,"NA" => missing)
34+
replace!(col, "NA" => missing)
3535
end
3636
data = identity.(data_raw)
3737
push!(out, key => data)
3838
end
3939
return out
4040
end
41-
end
41+
end

0 commit comments

Comments
 (0)