Function to add correlated noise to data
generateIC.Rd
Function to add correlated noise to data
Arguments
- data
data to be assessed for correlation
- corrs
matrix definig the correlation for each panel (each row of matrix) defined in the data
- panels
character giving the column of
data
contaning the information about panel structure- newdata
simulated sets of data (independent)
- nsim
number of simulations
- dots
(default = FALSE). Logical flag stating whether to show progress dots printed in workspace.
Examples
data(nystedA_slim)
nysted$panelid<-as.numeric(nysted$unique.transect.label)
model<-glm(response ~ depth + as.factor(phase),
family='poisson', data=nysted)
#> Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]): contrasts can be applied only to factors with 2 or more levels
simData<-generateNoise(n=500, response=fitted(model), family='poisson')
#> Error: object 'model' not found
corrs<-getCorrelationMat(panel = nysted$panelid, data=nysted$response, dots = FALSE)
generateIC(nysted, corrs, "panelid", simData, nsim=10, dots = FALSE)
#> Warning: package 'Hmisc' was built under R version 4.4.3
#> Error: object 'simData' not found