R: Analysis of sensory data within a mixed effects model...
sensmixed
R Documentation
Analysis of sensory data within a mixed effects model framework
Description
Constructs a mixed effects model for each of the selected by user attributes
according to the specified by the user structure arguments. If required, then
the random structures are reduced by eliminating NS random effects.
The likelihood ratio test (LRT) is used for testing random terms, F-type
hypothesis test is used for testing fixed terms
names of the replication column in the data, if present
individual
name of the column in the data that represent assessors
data
data frame (data from sensory studies)
product_structure
one of the values in c(1, 2, 3). 1: only main effects will enter the initial
biggest model. 2: main effects and 2-way interaction.
3: all main effects and all possible interaction
error_structure
one of the values in c("No_Rep", "2-WAY", "3-WAY"). "No_Rep" and "2-WAY" -
assessor effect and all possible interactions between assessor and
Product_effects. "3-WAY" - assessor and replicate effect and interaction
between them and interaction between them and Product_effects
MAM
logical. if MAM model should be constructed (scaling correction)
mult.scaling
logical. Whether multiple scaling should be used
oneway_rand
logical. Whether there should be just prod effect as part of the random part in MAM
MAM_PER
logical. if MAManalysis function should be called (scaling correction)
adjustedMAM
logical. should MAM be adjusted for the scaling
alpha_conditionalMAM
logical. scaling should be part of the model in case its p-value
is less than alpha_conditionalMAM
calc_post_hoc
logical. Should the post hoc analysis be performed on the final resuced
models for all the attributes
parallel
logical. Should the computation be done in parallel. the default is FALSE
reduce.random
logical. Eliminate non-significant random effects according to
alpha.random or not. The default is TRUE
alpha.random
significance level for elimination of the random part (for LRT test)
alpha.fixed
significance level for elimination of the fixed part (for F test)
interact.symbol
symbol for the indication of the interaction between effects. the default
one is ":".
keep.effs
which effects should be kept in a model.
...
other potential arguments.
Value
FCHi
matrix with Chi square values from LRT test and F values
form F-type test for the selected attributes
pvalue
matrix withp-values for all effects for the selected attributes
Author(s)
Alexandra Kuznetsova, Per Bruun Brockhoff, Rune Haubo Bojesen Christensen
Examples
#import SensMixed package
library(SensMixed)
#convert some variables to factors in TVbo
TVbo <- convertToFactors(TVbo, c("Assessor", "Repeat", "Picture"))
#run automated selection process
res <- sensmixed(c("Coloursaturation", "Colourbalance"),
Prod_effects = c("TVset", "Picture"), replication="Repeat",
individual="Assessor", data=TVbo, MAM=TRUE)
## run MAManalysis function
res_MAM <- sensmixed(c("Coloursaturation", "Colourbalance"),
Prod_effects=c("TVset"), replication="Repeat",
individual="Assessor", data=TVbo, MAM_PER=TRUE)
## print is not yet implemented
## get anova part
res_MAM[[3]][,,1]
## compare with the general implementation
res <- sensmixed(c("Coloursaturation", "Colourbalance"),
Prod_effects=c("TVset"),
individual="Assessor", data=TVbo, MAM=TRUE,
reduce.random=FALSE)
res$fixed
## Not run:
plot F and Chi square values
plot(result)
## End(Not run)
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(SensMixed)
Loading required package: lmerTest
Loading required package: Matrix
Loading required package: lme4
Attaching package: 'lmerTest'
The following object is masked from 'package:lme4':
lmer
The following object is masked from 'package:stats':
step
Attaching package: 'SensMixed'
The following object is masked from 'package:lmerTest':
ham
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SensMixed/sensmixed.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sensmixed
> ### Title: Analysis of sensory data within a mixed effects model framework
> ### Aliases: sensmixed
>
> ### ** Examples
>
>
>
> #import SensMixed package
> library(SensMixed)
>
> #convert some variables to factors in TVbo
> TVbo <- convertToFactors(TVbo, c("Assessor", "Repeat", "Picture"))
>
> #run automated selection process
> res <- sensmixed(c("Coloursaturation", "Colourbalance"),
+ Prod_effects = c("TVset", "Picture"), replication="Repeat",
+ individual="Assessor", data=TVbo, MAM=TRUE)
| | | 0%fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
| |=================================== | 50%fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
| |======================================================================| 100%
>
>
> ## run MAManalysis function
> res_MAM <- sensmixed(c("Coloursaturation", "Colourbalance"),
+ Prod_effects=c("TVset"), replication="Repeat",
+ individual="Assessor", data=TVbo, MAM_PER=TRUE)
> ## print is not yet implemented
> ## get anova part
> res_MAM[[3]][,,1]
SS MS DF F Pval
Assessor 54.66 7.81 7 1.21 0.3571
Product 221.51 110.76 2 16.11 0.0024
Scaling 41.89 5.98 7 0.87 0.5703
Disagreement 48.13 6.88 7 7.15 0.0000
Error 161.67 0.96 168 NA NA
>
> ## compare with the general implementation
> res <- sensmixed(c("Coloursaturation", "Colourbalance"),
+ Prod_effects=c("TVset"),
+ individual="Assessor", data=TVbo, MAM=TRUE,
+ reduce.random=FALSE)
| | | 0%fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
| |=================================== | 50%fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
| |======================================================================| 100%
> res$fixed
$Fval
Coloursaturation Colourbalance
TVset 16.10851 5.582796
$pvalueF
Coloursaturation Colourbalance
TVset 0.002402623 0.03551977
>
> ## Not run:
> ##D plot F and Chi square values
> ##D plot(result)
> ## End(Not run)
>
>
>
>
>
>
>
>
> dev.off()
null device
1
>