#MARS
library(earth)
require(MASS)
# fit model
fit <- earth(formula=SPEEDING_CRASH ~
log(AVG_AADT)+LANDUSE_MIX+PAVEMENT_CONDITION+ISLDWIDTH+
P_BOTH_SIDEWALK_ONLY+HIGH_FREQ_TRANSIT+SIGNAL_PER_MILE+
MEDIAN_WIDTH+DAILY_TRANSIT+PAVEMENT_CONDITION+LANE_WIDTH
, a, degree=1)
fit
plot(fit)
# summarize the fit
summary(fit)
# summarize the importance of input variables
evimp(fit)
plot(evimp(fit))
# make predictions
predictions <- predict(fit, a)
plot(fit)
# summarize accuracy
coefficients(fit)
residuals(fit)
mse <- mean((a$SPEEDING_CRASH - predictions)^2)
print(mse)
#standart error
vcov(fit)
standard_error(fit)
Std.Error(fit)
se <- sqrt(diag(vcov(fit)))
se.coef(fit)
sqrt(diag(cov(fit)))
#2 tailed z test
z<- coef(fit)/standard_error(fit)
p<- (1-pnorm(abs(z),0,1))*2
p #pvalue
0 comments:
Post a Comment