Hello.
I am beginning to analyze my work and have realized that a simple chi-square
analysis will not suffice for my research, with one notable reason is that data
are not discrete. Since my data fit the assumptions of a logistic regression, I
am moving forward with this analysis. With that said, I am a beginner with R
and would grealty appreciate any help!
Essentially, the point of my work is to determine if sharks are more sensitive
to repellents based on certain environmental parameters.
Therefore an incredibly simplified version of my bullsharkdata .txt file would
look like this (Note: (1) = low density/visibility and (2) = high
density/visibility; and behavior = (1) or avoidance behavior) :
Obs Density Visibility Behavior Data
1 1 1 1 0.9
2 2 1 1 0.1
3 1 2 1 0.3
4 2 2 1 0.8
Here was my attempt at coding:
bullsharks <- read.table("bullsharkdata.txt", header=T, as.is=T)
#"bullsharks" is what I named it
bullsharks$Obs
bullsharks$Density
bullsharks$Visibility
bullsharks$Behavior
bullsharks$Data
#or to view all data
bullsharks
library(mlogit)
bullsharks[1:2,]
bullsharks$Density<-as.factor(bullsharks$Density)
mldata<-mlogit.data(bullsharks, varying=NULL, choice="Density",
shape="wide")
mlogit.model <- mlogit(Density~1|Visibility+Behavior, data = mldata,
reflevel="1")
summary(mlogit.model)
However, I get an error at the mlogit.model stage. Is there something wrong
with my data or with my code?
Thank you and any help would be incredibly appreciated!
[[alternative HTML version deleted]]