posteriorTime_NaiveMLE: posteriorTime_FullBayesian

Description Usage Arguments Details Value Author(s) Examples

View source: R/posteriorTime_NaiveMLE.R

Description

Calculating the posterior distribution of time for new individuals

Usage

1
2
3
4
5
6
7
8
posteriorTime_NaiveMLE(
  New_Y,
  Data_Y,
  Data_time,
  maxTime = 12,
  delta = 0.01,
  priorTime = NULL
)

Arguments

New_Y

The observed response for new individuals (nsamples x nsites) matrix (also possible with vector)

Data_Y

This is observed multi-responses (nsamples x nsites)

Data_time

This is observed times (nsamples vector)

maxTime

maximum of time (upper limit)

delta

Grid size for the time variable

priorTime

A prior distribution for the time variable (NULL means uniform distribution)

Details

This function provides posterior distribution of time, based on a multivariate model (Naive MLE approach), where time as a continuous exploratory variable from zero to maxTime

Prediction: Applying Bayes Theorem: p(time|Y) = konstant x p(Y|time) x p(time) We assume an uniform prior for p(log(time))=unif, gives p(time)=1/t

Model: p(Y|time,theta)=MVN(b0 + b1*time, SIGMA), SIGMA= COVARIANCE MATRIX where theta is estimated using maximum likelihood estimation (MLE), provided as theta_hat

Predictor p(Ynew|time)=p(Ynew|time,theta=theta_hat)

Value

ret list with posterior distribution for each new individuals (separate list for univariate prediction and all combined)

Author(s)

Oyvind Bleka

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run:  
ntrain = 100
ntest = 100
dat = genData(ntrain+ ntest,seed=1)
Data_Y = dat$Data_Y[1:ntrain,]
Data_time = dat$Data_time[1:ntrain]
New_Y = dat$Data_Y[-(1:ntrain),]
New_time = dat$Data_time[-(1:ntrain)]
predObj = posteriorTime_NaiveMLE(New_Y, Data_Y, Data_time)

## End(Not run)

oyvble/TSDpredict documentation built on June 28, 2020, 10:42 a.m.