Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⸂𝖶𝖩𝖣 . #17

Open
turxy opened this issue Dec 28, 2023 · 0 comments
Open

⸂𝖶𝖩𝖣 . #17

turxy opened this issue Dec 28, 2023 · 0 comments

Comments

@turxy
Copy link

turxy commented Dec 28, 2023

This script reproduces, in sequence, the results and examples

in the accompannying paper. (Please note that a full run of the

script may take between a few hours and a day to run depending

on the computer.)

Package version information:

A3 0.9.2

e1071 1.6-1

randomForest 4.6-7

xtable 1.7-1

pbapply 1.0-5

R 2.15.2 OS X 64 bit

Due to the usage of stochasticity in the A3 method, minor

differences in results may be obtained if different versions of

packages are used. These differences will be minor and not

affect overall conclusions.

Each block represents an output (either a table or a figure) in

the original paper. Blocks are sequential as the results appear

in the paper.

set.seed(1)
library("A3")
print(a3(formula = rating ~ ., data = attitude, model.fn = lm))

library("e1071")
print(a3(rating ~ . + 0, attitude, svm))

library("randomForest")
out.rf <- a3(rating ~ . + 0, attitude, randomForest, p.acc = 0.05)
print(out.rf)

print(a3(rating ~ . + 0, attitude, randomForest, p.acc = 0.05, model.args = list(ntree = 1000)))

print(out.rf)

plotPredictions(out.rf)

plotSlopes(out.rf)

data("housing", package = "A3")
reg <- lm(MED.VALUE ~ AGE + ROOMS + NOX + PUPIL.TEACHER + HIGHWAY, housing)
print(summary(reg))

NOTE: this may take 2 hours+; this data is cached in a file in data/ for article generation

housing.lm <- a3.lm(MED.VALUE ~ AGE +ROOMS + NOX + PUPIL.TEACHER + HIGHWAY, housing,
p.acc = 0.01, n.folds = 50)
print(housing.lm)

NOTE: this may take 2 hours+; this data is cached in a file in data/ for article generation

housing.svm <- a3(MED.VALUE ~ AGE +ROOMS + NOX + PUPIL.TEACHER + HIGHWAY+0, housing, svm,
p.acc = 0.01, n.folds = 50)
housing.rf <- a3(MED.VALUE ~ AGE +ROOMS + NOX + PUPIL.TEACHER + HIGHWAY+0, housing, randomForest,
p.acc = 0.01, n.folds = 50)

print(housing.svm)
print(housing.rf)

plotSlopes(housing.rf)

NOTE: this may take 2 hours+; this data is cached in a file in data/ for article generation

data("multifunctionality", package = "A3")
reg <- lm(MUL ~ SR + SLO + SAC + PCA_C1 + PCA_C2 + PCA_C3 + PCA_C4 + LAT + LONG + ELE,
multifunctionality)
print(summary(reg))

NOTE: this may take 2 hours+; this data is cached in a file in data/ for article generation

mult.lm <- a3.lm(MUL ~ SR + SLO + SAC + PCA_C1 + PCA_C2 + PCA_C3 + PCA_C4 + LAT + LONG + ELE,
multifunctionality, p.acc = 0.01, n.folds = 50)
print(mult.lm)

NOTE: this may take 2 hours+; this data is cached in a file in data/ for article generation

mult.rf <- a3(MUL ~ SR + SLO + SAC + PCA_C1 + PCA_C2 + PCA_C3 + PCA_C4 + LAT + LONG + ELE + 0,
multifunctionality, randomForest, p.acc = 0.01, n.folds = 50)
print(mult.rf)

set.seed(1)
createAutoCorrelatedSeries <- function(n, r) {
dat <- rnorm(n, 0, 1)
for(i in 2:n) dat[i] <- dat[i-1]r + dat[i](1-r)
dat
}
sample <- data.frame(x = createAutoCorrelatedSeries(100, 0.95),
y = createAutoCorrelatedSeries(100, 0.95))
reg <- lm(y ~ x, sample)
print(summary(reg))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant