So I have data from a randomized blind trial of 1mg of nicotine gum on dual n-back working memory scores; I analyzed them as usual with a t-test and found a small increase in means but a large increase in standard deviations on a f-test! Strange. I also have data for each day on mood/productivity that day on a 1-5 scale.
I wondered: is nicotine following an inverse U-curve, where it causes higher scores on the worser days (1-3) and lower scores on the better days (3-5)? I look around and it seems I want a multinomial logistic regression comparing the placebo & active days.
I enter the data & load mlogit
:
nicotine <- read.table(stdin(),header=TRUE)
day active mp score
20120824 1 3 35.2
20120827 0 5 37.2
20120828 0 3 37.6
20120830 1 3 37.75
20120831 1 2 37.75
20120902 0 2 36.0
20120905 0 5 36.0
20120906 1 5 37.25
20120910 0 5 49.2
20120911 1 3 36.8
20120912 0 3 44.6
20120913 0 5 38.4
20120915 0 5 43.8
20120916 0 2 39.6
20120918 0 3 49.6
20120919 0 4 38.4
20120923 0 5 36.2
20120924 0 5 45.4
20120925 1 3 43.8
20120926 0 4 36.4
20120929 1 3 43.8
20120930 1 3 36.0
20121001 1 3 46.0
20121002 0 4 45.0
20121008 0 2 34.6
20121009 1 3 45.2
20121012 0 5 37.8
20121013 0 4 37.2
20121016 0 4 40.2
20121020 1 3 39.0
20121021 0 3 41.2
20121022 0 3 42.2
20121024 0 5 40.4
20121029 1 2 41.4
20121031 1 3 38.4
20121101 1 5 43.8
20121102 0 3 48.2
20121103 1 5 40.6
library(mlogit)
Nicotine <- mlogit.data(nicotine,shape="wide", choice="mp")
mlogit(score ~ (active + mp)^2, Nicotine)
Error in solve.default(H, g[!fixed]) :
Lapack routine dgesv: system is exactly singular
Calls: mlogit ... mlogit.optim -> as.vector -> solve -> solve.default
The error also happens even with the simplest call I can think of:
mlogit(score ~ active, Nicotine)
Error in solve.default(H, g[!fixed]) :
Lapack routine dgesv: system is exactly singular
Calls: mlogit ... mlogit.optim -> as.vector -> solve -> solve.default
Reading the documentation for mlogit
didn't much help, and look at the other questions having the same error, they're different enough I can't tell whether they apply or not.
Thank you for your assistance.
table(nicotine$mp, nicotine$active)
. It appears you have separation:mp=4
is always associated withactive=0
. This is likely the problem. $\endgroup$mlogit(score ~ 1 | active, Nicotine)
. The call ismlogit(Depvar ~ generic | altspec)
$\endgroup$summary(mlogit(mp ~ active, Nicotine))
which produce no relationship as expected. $\endgroup$