tucson tucson - 1 month ago 9
R Question

R gmm package use for prediction

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
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)

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

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

What am I missing?


you need the following commands at the top

library(gmm) data(Finance)