Ready to Use EDM on R

Apr 13, 2020

2 mins read

I wrote MEMO that the preparation for running rEDM using EC2.

  • EDM: Emprical Dynamic Modeling
  • rEDM: R packages using EDM
  • EC2(Official name: Amazon Elastic Compute Cloud): one of the AWS platforms. The above MEMO focuses on after establishing an instance on EC2.

The following text is the clone of the above MEMO.

How to use rEDM in AWS(EC2) -MEMO-

This entry describes the preparation for running rEDM using EC2.

Connect instance in AWS(EC2)

  • Login to EC2
  • Make instance (This page is supporting only for Ubuntu)
  • Click to “CONNECT”
  • Excute following command in directory, which has .pem file
    ssh -i "hogehoge.pem" ubuntu@hugahuga.compute.amazonaws.com
    

File(or Directory) import (local to AWS)

scp -i ./hogehoge.pem -r [directories] ubuntu@hugahuga.compute.amazonaws.com:~/mydir/

Update R

  • Check codename of Ubuntu
    lsb_release -cs
    
  • Register the mirror site of the download source by adding at /etc/apt/sources.list
    echo -e "\n## For R package"  | sudo tee -a /etc/apt/sources.list
    echo "deb https://cran.ism.ac.jp//bin/linux/ubuntu $(lsb_release -cs)-cran35/" | sudo tee -a /etc/apt/sources.list
    
    • cran35 means that a repository providing R 3.5.x for bionic
  • Register the public key
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    
  • And then apt-get
    sudo apt update
    sudo apt-get install r-base
    

Ref

rEDM installation

Preparations in advance

  • Install curl and xml and ssl on linux
    sudo apt-get install libcurl4-openssl-dev
    sudo apt-get install libxml2-dev    
    sudo apt-get install libssl-dev
    

rEDM installation

install.packages(remotes)
remotes::install_github("ha0ye/rEDM")
library(rEDM)

!!caution!!

rEDM latest version(190422) DOESN’T have twin surrogate method by default… So if you would like to use this method, 1. install rEDM ver.0.7.1, or 2. read data_transformations.R

Refs

  1. install rEDM ver.0.7.1

    install.packages("repmis")
    library(repmis)
    InstallOldPackages(pkgs = "rEDM", versions = "0.7.1")
    
  2. read data_transformations.R

    1. create data_transformations.R by copy & paste above page

    2. and then read this file

      source(data_transformations.R)
      

Refs

Sharing is caring!