0

I wish to try the R gmm algorithm to predict.

Question #1: is it possible to use gmm to predict? (the word "predict" does not appear in the manual)

Question #2: if it is possible to do prediction with gmm, how does one do it?

I am looking for the simplest example; for example using svm would be done with:

model <- svm(train, trainLabels)
testpred <- predict(model, test)

Question #3: I cannot even reproduce the examples mentioned in the manual. Page 24 shows the code:

## CAPM test with GMM
data(Finance)
r <- Finance[1:300, 1:10]
rm <- Finance[1:300, "rm"]
rf <- Finance[1:300, "rf"]
z <- as.matrix(r-rf)
t <- nrow(z)
zm <- rm-rf
h <- matrix(zm, t, 1)
res <- gmm(z ~ zm, x = h)
summary(res)

but even after installing the package gmm, R does not know the data Finance.

> data(Finance)
Warning message:
In data(Finance) : data set ‘Finance’ not found

What am I missing?

Eric Fail
  • 8,191
  • 8
  • 72
  • 128
Timothée HENRY
  • 14,294
  • 21
  • 96
  • 136
  • concerning question 3: it works for me. Did you load the package gmm first? This would be done with `library(gmm)` before `## CAPM test with GMM data(Finance)...` – speendo Oct 25 '13 at 14:49

1 Answers1

2

you need the following commands at the top

library(gmm)
data(Finance)
Sandipan Dey
  • 21,482
  • 2
  • 51
  • 63