Function that predicts periodic time courses using parameters identified by fit.periodic().
Usage
predictTimecourses(res.fits)
Arguments
res.fits
List object returned by fit.periodic().
Details
This function takes as input the result list from MoPS function fit.periodic() and creates a list of best fitting time courses.
The input list also contains information about the screening parameters, which is used in the generation of predicted time courses.
Value
a numeric matrix containing the predicted values.
The number of rows equals the number of rows of the original data matrix, the number of columns equals the number of screened phases.
Author(s)
Philipp Eser, Achim Tresch
Examples
x = seq(0,40,by=1) # time points
## create 10 periodic time series with added noise
mat.p = matrix(rep(x,10),nrow=10,ncol=length(x),byrow=TRUE)
y = -seq(1:10)
mat.p = apply(mat.p,2,function(x){
y = sin(pi*(x/41*6)+y)+rnorm(length(x),sd=1)
})
## add 10 non-periodic noisy time series
mat.nonP = matrix(rep(x,10),nrow=10,ncol=length(x),byrow=TRUE)
mat.nonP = apply(mat.nonP,2,function(x){
y = rnorm(length(x),sd=1)
})
mat = rbind(mat.p,mat.nonP)
res = fit.periodic(mat,phi=seq(0,20,1),lambda=seq(1,20,1))
time.courses = predictTimecourses(res)
plot(mat[1,],type="l",main="",xlab="",ylab="")
points(time.courses[1,],type="l",col="limegreen",lwd=2)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MoPS)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/MoPS/predictTimecourses.Rd_%03d_medium.png", width=480, height=480)
> ### Name: predictTimecourses
> ### Title: Prediction of periodic time courses.
> ### Aliases: predictTimecourses
>
> ### ** Examples
>
>
> x = seq(0,40,by=1) # time points
>
> ## create 10 periodic time series with added noise
> mat.p = matrix(rep(x,10),nrow=10,ncol=length(x),byrow=TRUE)
> y = -seq(1:10)
> mat.p = apply(mat.p,2,function(x){
+ y = sin(pi*(x/41*6)+y)+rnorm(length(x),sd=1)
+ })
>
> ## add 10 non-periodic noisy time series
> mat.nonP = matrix(rep(x,10),nrow=10,ncol=length(x),byrow=TRUE)
> mat.nonP = apply(mat.nonP,2,function(x){
+ y = rnorm(length(x),sd=1)
+ })
>
> mat = rbind(mat.p,mat.nonP)
>
> res = fit.periodic(mat,phi=seq(0,20,1),lambda=seq(1,20,1))
4600 linear regressions will be performed. This will take < 5 minutes.
Creating test functions ....
0 %
10 %
20 %
30 %
40 %
50 %
60 %
70 %
80 %
90 %
100 %
Fitting of test functions to data ....
0 %
10 %
20 %
30 %
40 %
50 %
60 %
70 %
80 %
90 %
100 %
There were 40 warnings (use warnings() to see them)
> time.courses = predictTimecourses(res)
>
> plot(mat[1,],type="l",main="",xlab="",ylab="")
> points(time.courses[1,],type="l",col="limegreen",lwd=2)
>
>
>
>
>
>
> dev.off()
null device
1
>