Guest User

Untitled

a guest
Jan 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. x <- 1:100
  2. y <- cos(x/15)+rnorm(length(x), sd=.3)
  3.  
  4. library(splines)
  5. b <- bs(x, knots = c(25, 50, 75))
  6.  
  7. f <- lm(y~b)
  8.  
  9. head(b)
  10.  
  11. plot(x,y)
  12. lines(x,predict(f))
  13.  
  14.  
  15. # for gene expression (e.g., limma/edgeR), could make a design matrix with
  16. # mm <- model.matrix(~b) .. where 'x' above corresponds to the inferred pseudotime
  17. # and you'd have to match the knots to the scale of the pseudotime
Add Comment
Please, Sign In to add comment