[R-sig-ME] Logit model in R

landon hurley |jrhur|ey @end|ng |rom gm@||@com
Mon Oct 21 18:47:35 CEST 2019


Chiara,

> I would like to ask which code i have to write in R to calculate the
> percentage of categorial responses "Yes" or "Not" delivered for each of my
> 15 perceptual stimuli.

Typically the mean of a sequence of binary yes/no questions would be
sufficient to answer this question. Take the m x n data set matrix D
with n> 15 and apply the code

colMeans(D[,1:15])

to compute the mean of each column vector. The sequence 1:15 denotes the
list sequence from the number 1 to the number 15, increasing by 1 at
each step. If the 15 stimuli are not in sequential order, then they must
be identified by the index sequence c(a,b,...,o) for which each letter
is replaced by the respective column number of matrix D. Alternatively,
the indices can be column names instead of numbers, for which each
number must be enclosed in a separate " " quote string.

colMeans(D[,c(a,b,...,o)])

As a side note, you may wish to consider that since this is a mailing
list for mixed models, it would be perhaps advisable to perhaps consider
Stack Exchange or some other mailing list or other forum strictly
devoted to performing basic operations in R. Also, since your email
message has nothing to do with the implementation of a logit model in R,
perhaps a better choice of email subject header would benefit in
directing individuals to addressing your question.

If you are interested in ultimately performing a regression upon a
categorical unordered outcome measure, then I would recommend
investigating the glm function in R, with the family operation set to
'binomial'.

best,
> Many thanks,
> Chiara
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 


-- 
Violence is the last refuge of the incompetent.



More information about the R-sig-mixed-models mailing list