Giter VIP home page Giter VIP logo

hdlfpca's Introduction

HDLFPCA

R build status

The goal of HDLFPCA is to Perform High-dimensional Longitudinal PCA.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("seonjoo/HDLFPCA")

Usage

library(HDLFPCA)
example_hd_data = generate_hd_data(I = 100)
phix0 = example_hd_data$phix0
phix1 = example_hd_data$phix1
phiw = example_hd_data$phiw
Y = example_hd_data$Y
time = example_hd_data$time
J = example_hd_data$J
I = example_hd_data$I
visit = example_hd_data$visit
re <- hd_lfpca(
    Y,
    T = scale(time, center = TRUE, scale = TRUE),
    J = J,
    I = I,
    visit = visit,
    varthresh = 0.95,
    projectthresh = 1,
    timeadjust = FALSE,
    figure = TRUE
  )
#> Reduce Dimension
#> Estimate Covariance Functions
#> Calcuate Scores
#> Compute Residual to the Demeaned Data.
#> Residual of LFPCA Model is: 9872.67284871758

cor(phix0, re$phix0)
#>             [,1]        [,2]        [,3]        [,4]
#> [1,]  0.99720326  0.09083731  0.02831191 -0.03210385
#> [2,]  0.04360455 -0.99192254  0.03077443  0.07037896
#> [3,] -0.02504620  0.01250388 -0.97917094  0.11347137
cor(phix1, re$phix1)
#>             [,1]        [,2]         [,3]       [,4]
#> [1,]  0.99755948  0.08022781 -0.001390277 0.12272830
#> [2,]  0.04494263 -0.98371159  0.029040865 0.05042425
#> [3,] -0.02278886  0.01911020 -0.993862522 0.07308564

library(gplots)
#> 
#> Attaching package: 'gplots'
#> The following object is masked from 'package:stats':
#> 
#>     lowess
par(mfrow = c(2, 2),
    mar = rep(0.5, 4),
    bg = "gray")
bs = c(-100:100) / 1000 * 1.5

image(phix0,
      axes = FALSE,
      col = gplots::bluered(200),
      breaks = bs)
image(re$phix0[, 1:3],
      axes = FALSE,
      col = gplots::bluered(200),
      breaks = bs)
image(phix1,
      axes = FALSE,
      col = gplots::bluered(200),
      breaks = bs)
image(re$phix1[, 1:3],
      axes = FALSE,
      col = gplots::bluered(200),
      breaks = bs)

hdlfpca's People

Contributors

muschellij2 avatar seonjoo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.