lsmeans | R package for least-squares means | Machine Learning library
kandi X-RAY | lsmeans Summary
kandi X-RAY | lsmeans Summary
R package lsmeans: Least-squares means (estimated marginal means).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lsmeans
lsmeans Key Features
lsmeans Examples and Code Snippets
Community Discussions
Trending Discussions on lsmeans
QUESTION
I can't figure out why my loop isn't working.
I have a database (36rows x 51columns, its name is "Seleccio") consisting of 3 factors (first 3 columns: Animal (12 animals), Diet (3 diets) and Period (3 periods)) and 48 variables (many clinical parameters) with 36 observations per column. It is a 3x3 crossover design so I want to implement a mixed model to include the Animal random effect and also Period and Diet fixed effects and the interaction between them.
A sample of the data (but with less rows and columns):
...ANSWER
Answered 2021-May-31 at 15:44I don't think i can run the model with only 6 observations, so i couldn't find why would your loop doesn't return the same as doing it one by one. Maybe the problem is with cat(colnames(Seleccio)[i])
: you only want the Var names, and for i=1, 2 and 3, that code will return "Animal", "Diet" and "Period", thus messing up how you're comparing the results. Using cat(colnames(vars)[i])
might correct that. If you find a way to include more observations of Seleccio
i might be able to help more.
I would suggest you to create a list to store the output:
QUESTION
I would like to test the simetry in the response of an observer to a contrast stimuli with different polarity, positive (white) and negative (black). I took the reaction time (RT) as dependent variable, along four different contrasts. It is known that the response time follows a Pieron curve whose asymptotas are placed (1) at observer threshold (Inf) and (2) at a base RT placed somewere between 250 and 450 msec. The knowledge allows us to linearize the relationship transforming the independent variable (effective contrast EC) as 1/EC^2 (tEC), so the equation linking RT to EC becomes:
RT = m * tEC + RT0
To test the symmetry I established the criteria: same slope and same intercept in the two polarities implies symmetry. To obtain the coefficients I made a linear model with interaction (coding trough a dummy variable for Polarity: Positive or Negative). The output of lm is clear to me, but some colegues prefer somthing more similar to an ANOVA output. So I decided to use emmeans to make the contrasts. With the slope is all right, but when computing the interceps starts the problem. The intercepts computed by lm are very different from the output of emmeans, and the conclusions are also different. In what follows I reproduce the example. The question is two fold: It is possible to use emmeans to solve my problem? If not, it is possible to make the contrasts through other packages (which one)?
Data RT1000 EC tEC Polarity 596.3564 -25 0.001600 Negative 648.2471 -20 0.002500 Negative 770.7602 -17 0.003460 Negative 831.2971 -15 0.004444 Negative 1311.3331 15 0.004444 Positive 1173.8942 17 0.003460 Positive 1113.7240 20 0.002500 Positive 869.3635 25 0.001600 Positive Code ...ANSWER
Answered 2021-Apr-30 at 16:28What you are calling the intercepts are not; they are the model predictions at the mean value of tEC
. If you want the intercepts, use instead:
QUESTION
Hoping that you can clear some confusion in my head.
Linear mixed model is constructed with lmerTest
:
ANSWER
Answered 2021-Apr-22 at 14:22I'm pretty sure this has to do with the dreaded "denominator degrees of freedom" question, i.e. what kind (if any) of finite-sample correction is being employed. tl;dr emmeans
is using a Kenward-Roger correction, which is more or less the most accurate available option — the only reason not to use K-R is if you have a large data set for which it becomes unbearably slow.
QUESTION
I am reviewing one way ANOVAs and trying to integrate least squared means. Here is an example from mtcars.
...ANSWER
Answered 2021-Apr-16 at 17:21That is the work of tukeyHSD
fucntion:
QUESTION
ANSWER
Answered 2021-Apr-15 at 21:21Here's a two step solution. First you'll need to transform the data to get some variables that will make it easier to construct the desired plot.
QUESTION
I am using Proc glimmix to run a random intercept model on a continuous outcome over five time points. Table Type III indicates sex is not significant while the 95% CIs of male and females in table lsmeans have no overlap. I wonder how to explain this discrepancy? When I look at the male and female outcomes over time I also expect a significant higher outcome for males as the CIs in the second table say. Many thanks!
...ANSWER
Answered 2021-Mar-30 at 21:27It is incorrect to test the significance of a difference based on seeing if the CIs for the means overlap. The means and the difference of the means are two different statistical animals, with their own distributions and their own standard errors. The SE of the difference M - F is sqrt(SE(M)^2 + SE(F)^2 -2*Cov(M,F))
. and that can be vastly different from SE(M) + SE(F)
which is implicitly assumed when you compare confidence intervals. Moreover, in a mixed model,the degrees of freedom can differ vastly, and that covariance term can be anything.
To get SAS to compute the right estimates, use an ESTIMATE
statement to construct the desired quantity.
QUESTION
I have to analyze an experiment data set to find a most effective combination of a molecular biology reaction.
The experiment has four factors: Temperature, RPM, Time, Catalytic activity. And I am measuring the Efficiency of a reaction (EE). How can I find an effective combination of four factors for the highest efficiency(EE)?
- No repeated measurements. All data are independent experimental data
As I understood - EE is parametric data, factors are categorical data (Fixed combinations). Do I have to go for a Fourway ANOVA?
if so is this model correct for the analysis
...ANSWER
Answered 2021-Mar-18 at 03:20For a screening DOE you collected more data than what was needed. Here is a starting point, I welcome additional comments.
I would model the linear combination of all of your factors:
QUESTION
How do I write the model
statement in proc mixed
to study the interaction between a factor with a second factor nested within a third factor?
- So
factor_1
is independent from the others (like year is independent from location) - but
factor_2
is a subdivision offactor_3
(like province is a subdivision of state).
I would expect it to be model factor_1 * factor_2(factor_3);
but that does not work.
I am trying to model this Crossed - Nested Design example from an Analysis of Variance and Design of Experiments course of Eberly College of Science using the techniques from this Nested Treatment Design example and the instructions given in this video.
Loading my data with ...ANSWER
Answered 2021-Jan-03 at 17:01Distribute law wise
QUESTION
I am trying to predict the mean abundance of animals sighted during different moon phases (factor), using log-transformed abundance data (better fit) and some other variables. The best model (lowest AIC) turned out to include the interaction of phase and survey duration and the cloud cover (both continuous):
...ANSWER
Answered 2020-Oct-14 at 18:48Use predict
to get predicted values. Don't calculate manually.
Use expand.grid()
to generate a data frame of all combinations of your dur2
sequence and the other predictors at the value(s) you want plot. Something like this:
QUESTION
I am trying to understand the results I got for a fake dataset. I have two independent variables, hours
, type
and response pain
.
First question: How was 82.46721 calculated as the lsmeans for the first type?
Second question: Why is the standard error exactly the same (8.24003) for both types?
Third question: Why is the degrees of freedom 3 for both types?
...ANSWER
Answered 2020-Sep-28 at 16:09Try this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install lsmeans
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page