I don't know if anyone on the list uses the package earth to run a MARS
analysis, but I am trying to run a loop of MARS runs and table the
variables that it selects as explanatory. However, looking at the help file
and names for an earth model, I can't find a good way of obtaining the
variable names that it selects. Here are my present attempts:

#attempt 1
vars = character()
> set.seed(3042)
> for(j in 1:1000){
+ rows = sample(1:length(rd4km$OBJECTID), 2000, replace=FALSE)
+ subrd4km = rd4km[rows, ]
+ model = earth(ff2006 ~
roadlength+Atl.dist+Atl.dir+roadd+easting+northing,  degree=1,
+   data=subrd4km,  glm=list(family=poisson))
+ vars=c(vars, rownames(model$glm.coefficients))
+
+ }

> head(table(vars))
vars
          (Intercept)              Atl.dirN             Atl.dirNE
                 1000                    99                   629
            Atl.dirNW              Atl.dirS             Atl.dirSE
                  571                   882                    55
            Atl.dirSW              Atl.dirW  h(-0.574228-easting)
                   79                   188                     3
  h(-100.574-easting)   h(-104.574-easting)   h(-108.574-easting)
                    1                     1                     5
  h(-112.574-easting)   h(-116.574-easting)   h(-12.5742-easting)

# attempt 2
dirf = character()
set.seed(3042)
for(j in 1:1000){
rows = sample(1:length(rd5$X), 2000, replace=FALSE)
subrd5 = rd5[rows, ]
model = earth(ff ~ roadd + Atldir,  degree=1,
  data=subrd5,  glm=list(family="poisson"))
dirf = c(dirf,
dimnames(model$coefficients)[[1]][length(dimnames(model$coefficients)[[1]])])
}
table(dirf)

The data is lightning flash density with a list of possible covariates.

Thanks for any help,
Sincerely,
Ona Strikas
Florida State University
Department of Geography
Graduate Student

	[[alternative HTML version deleted]]

