Questions tagged [r]

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

linear mixed model for a simple crossover trial

I would like to understand how to analyse a basic crossover trial using a linear mixed model. Participants have a baseline measure of the dependent variable, they are then randomised to either placebo ...
1
vote
0answers
28 views

Interpretation/ explanation for NA values produced by cox.zph

I have set up several Cox proportional hazards models in R, and am using cox.zph from the survival package to test the ...
7
votes
1answer
42 views

How to get rid of background noise in time series data?

I have a load of time-depth data collected from some birds on a field trip. I am trying to classify diving behaviour by setting a depth threshold past which a dive can be said to have occurred. ...
0
votes
0answers
12 views

How to plot ROC and Recall-precision curves for this obtained data

Good afternoon , Assume we have this obtained data : ( I had trained a SOM map from scratch then i used a number of epochs, Each epoch consist of a number of iterations ) : ...
0
votes
1answer
21 views

Scaling a gene expression data generates NA values

I would like to analyze the prostate gene expression data which has a link named 12859_2005_967_MOESM4_ESM.tgz in the site here. In a paper I read, the author scaled the predictors in the training set ...
1
vote
1answer
25 views

Why different results for the same factor once using Oneway and once Twoway ANOVA?

I am currently analysing data of eggs of laying hens that were fed with different forage. There were two forage in total, and eight group of laying hens. Four groups under forage 1 and four groups ...
1
vote
1answer
46 views

Generating random variable from no closed-form marginal density [closed]

Suppose $u\sim N(0,I_p)$ and $Y|U\sim N(x(t),\sigma_e^2I_m)$, and the marginal distribution of $y$ is $f(y)=\int_u f(y|u)f(u)du$. $x(t)$ is composite function of $u$, basically $x(t)$ is a function of ...
0
votes
0answers
8 views

Getting standard errors/confidence intervals with interaction terms in geeglm

I have the following geeglm model where X is a 3-level categorical variable (ref: X=1) and Z is a continuous variable: ...
0
votes
0answers
26 views

Random vector with a fixed sum: Distribution for its components

Suppose that I have a random vector $X=(p_1, p_2, ..., p_n)$ where each $0\leq p_i\leq 1$ and $\sum p_i = 1$. I would like to find distribution for each component $p_i$ and also other general ...
1
vote
0answers
34 views

Maximum likelihood parameter estimation for state space model (Kalman Filter)

it´s about a state space model that I want to run using the Kalman filter. However, certain parameters are unknown and must be estimated by the maximum likelihood method. The state space model is as ...
1
vote
0answers
24 views

Generating random variable from mixture representation [duplicate]

Suppose $u\sim N(0,I_p)$ and $Y|U\sim N(x(t),\sigma_e^2I_m)$, and the marginal distribution of $y$ is $f(y)=\int f(y|u)f(u)du$. $x(t)$ is composite function of $u$. The problem is I need to generate ...
0
votes
0answers
9 views

How can I generate seasonal count data that has two different expected values?

The motivation for my question is modelling changes in abundance of a species whose population is estimated from survey data. The challenge for me would be to see if ignoring a food indicator masks ...
0
votes
0answers
34 views

Does it make sense to include alternative-specific variables that do not vary over individuals in a multinomial logit model?

I have a dataset of individual farms and I want to model the probability for a farm to select a certain type of irrigation (options: none, surface, sprinkler, drip, other). As independent variables I ...
0
votes
0answers
14 views

eBay search phrase to listings relevance

Working on a quick PoC, and it’s based on eBay data. Basically, someone puts in a search phrase and receives a number of listings. These listings have been classified (not by eBay, but by my colleague)...
1
vote
1answer
39 views

What statistical test should I use to compare two slopes of dependent data?

I have some data on mean kinship values of a single population for a number of consecutive years. After plotting this data, I saw that the kinship coefficient is decreases a bit until 1994/1995, after ...
0
votes
0answers
12 views

Interpreting gam.check plots Poisson family

I have a question regarding GAM models using count data and the Poisson family. Here the data set I am using. In the photos: model summary and plots generated using gam.check from the R package "...
0
votes
0answers
10 views

Agreement between annotators on two variables evaluation

I have a dataset of 50 annotators that highlight(codified as 1) or not (codified as 0) a text, according to 2 different rules (call them A and B). The dataset is divided into a column for each word of ...
1
vote
0answers
16 views

Meta-analysis of time-to-event data for single group design

I would like to perform a meta-analysis of time-to-event data for a single group (i.e. there is no comparison group). How do I do so, what are the statistics required? I understand that for 2-group ...
0
votes
1answer
26 views

Does colinearity between independent factors weaken my model?

I understand if a linear regression model is used colinearity is a major problem and thus my model can be weak. However, what is the case if I got a trained model with high R-squared from other ...
1
vote
0answers
9 views

Which control charts to use to track mortality

I am trying to implement control charts in my organization (healthcare) to track various quality outcomes. The first one i want to do is mortality( # patient deaths/ month(or week) ). I have a data ...
0
votes
0answers
29 views

How to interpret variance explained and r-squared outcome from a multiple regression model in R?

I am running a regression model in R and I want to interpret the variance explained percentage, as well as, R-squared value. ...
2
votes
0answers
245 views

Do random forests work better than multinomial logistic regression for prediction of categorical non-binary variables? Why?

I posted another question that was well received. I am posting this new question because it was suggested by other members of Cross Validated. Here is the link of the original question that I posted: ...
0
votes
0answers
14 views

In R, how can I test if B1 = B2? [duplicate]

I have the following model : Y = B1X + B2X + e. I want to test if B1 = B2, and also if B1 = B2 = 0. Any suggestions to which test that would be appropiate? Thanks in advance.
1
vote
1answer
44 views

In R Linear Regression , a categorical variable is changed to numeric to build a model. Would that trick work to predict a categorical variable?

In R Linear Regression , a categorical variable is changed to numeric to build a model. Would that trick work to predict a categorical variable? Are these results valid? I have seen some R code that ...
0
votes
0answers
19 views

Binary predictive model in R

I want to develop a predictive model based on a binary dependent variable (1 if default, 0 otherwise). Based on methods like logistic regression, decision trees, and random forest in R. My independent ...
1
vote
0answers
22 views

Comparing variances of multiple correlated variables

I am trying to find a way to compare the variances of multiple variables in the same sample. More specifically, I have a sample of 118 participants who completed eight items (on the same 0-100 ...
-1
votes
0answers
20 views

How to recover estimates on original scale in log-linear model?

If fitting a linear model to a untransformed and log-transformed y variable, can anyone explain why the coefficients are different from the log-transformed model even after exponentiating the ...
2
votes
1answer
28 views

How to best impute missing values of county-level time series data using R?

I have a dataset consisting of mobility data at the county-level for the US for about one year. So the number of observations is >1m. Apart from the county code, the date, and the mobility index, ...
1
vote
1answer
52 views

Dealing with left-, right- and interval-censoring and left- and right-truncation

I have a survival data set with left-, right- and interval-censoring and left- and right-truncation. Now I want to fit a Cox proportional hazard and an AFT model to these data. What is the best way to ...
0
votes
0answers
7 views

Imposition of Long Run and Short-Run restrictions in SVAR in R language

I 'd like to ask a question about the imposition of LR and SR restrictions on an structural vector autoregressive model (SVAR) framework of analysis. I read the documentation of the vars and svars ...
0
votes
0answers
6 views

Maximum Absolute Deviation Test - Change of rank?

For the point process finpines (standard data set of the spatstat library), I would like to verify whether it satisfies the ...
1
vote
1answer
16 views

Viewing automated cost matrix for DHD in TraMineR

I'm using social sequence analysis, and comparing between different distance methods for my data. I'm wondering if there is a way to view/call the automatic substitution cost matrix that the dynamic ...
3
votes
1answer
33 views

Quantile regression on a constant: is this different from unconditional quantile?

With a linear model, estimating an OLS regression of y on a constant only will give us the mean of y. I was wondering whether ...
1
vote
0answers
34 views

Fitting sums of Gaussian-like density functions

I acknowledge that similar question has been asked a couple years ago, yet it still seems unresolved. Ignoring the domain knowledge, the statistical problem behind is to fit a non-linear regression ...
0
votes
0answers
12 views

Calculation of PCA composite index and forecast the composite index for a future period

I am trying to learn the Principal Component analysis. For that, I have pulled the yearly GDP and Inflation data and calculated the YOY Change in Inflation and GDP data to use in the PCA analysis. My ...
-1
votes
1answer
44 views

one sampled t-Test to compare against chance level performance

For an experiment, I want to test if people at each condition have performed significantly above chance level on average, in which they answer 3 questions, each with two options. I will compare each ...
0
votes
0answers
16 views

Regression power analysis: R's `pwr::pwr.f2.test` R2 deviation from zero vs. R2 increase (vs. G*Power)?

This question is about the difference between R's pwr::pwr.f2.test and G*Power regarding the ...
3
votes
1answer
26 views

Interpreting tweedie-location-scale result from R mgcv package

I came across the Tweedie-location-scale family function in R (twlss function from mgcv). It looks appealing to model my data. I understand the general concepts is that "twlss" family allows ...
0
votes
0answers
10 views

Why does a non-proportional odds model produce the Hauck-Donner effect while a proportional odds model does not?

I'm working with the pneumo dataset from the VGAM package. Here is the data: glimpse(pneumo) ...
0
votes
0answers
5 views

Using survey package with raked weights computed by ANESrake package

I have a survey with 12 strata in it (the geographic area was split into the 12 strata) and am interested in computing point estimates for the entire geographic area. Power allocation was used to ...
0
votes
0answers
12 views

How to extract the formula of a generalised linear mixed model?

I am trying to extract the formula for a generalised linear mixed model (GLMM). I have made the model from this dataset: ...
0
votes
1answer
23 views

Simulating slope coefficient for linear regression

I'm currently reading an article: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4302277/#S5title And in Section 5 I've come across a simulation for a few estimators of the slope $\beta_1$. I wanted to ...
2
votes
1answer
113 views

How to extract the shape parameter of a Fréchet fitted model using the R SPREDA package?

I'm trying to follow this post, which fits a Frechet distribution to some wind measurements as follows: ...
2
votes
0answers
25 views

fisher.exact test not returning expected p-value [duplicate]

I am trying to run Fisher Exact Test, however, I get unexpected results. I thought the two.sided p-value should be twice as large than the minimal one-sided p-value....
0
votes
0answers
14 views

Back Transformation on Multiple Linear Regression

I am currently using stock market time-series data that I have collected myself. This is volume data, not price, but that won't relate to this. I noticed heteroskedasticity in my model and other clues ...
1
vote
1answer
33 views

Comparing time series data at different points? (chemical transects from 24 fish otoliths)

I have 24 time series that are chemical transects from 24 fish otoliths (representing the chemical environment experienced by each fish over the entire life history). Each time series is the same ...
1
vote
0answers
14 views

matching on weights after multinomial propensity score [duplicate]

I am trying to do an analysis using matching on propensity score weights. In my data, treatement is a 3-class variable: no treatment, treatment 1, treatment 2. Outcome is a 2-class variable: 0 or 1 As ...
0
votes
0answers
10 views

Understanding difference between glmer summary() output and anova() output [duplicate]

I am fitting a general linear model using glmer from lme4 on data with a binary outcome (0 and 1). This is choice trial data with approximately 140 choices per participant. The model I run is as ...
1
vote
1answer
21 views

Robust linear regression for group differences

I am trying to understand what it means when a p value for a grouping variable is < 0.05 after running robust linear regression. Does this mean that the 2 groups significantly differ with respect ...
3
votes
1answer
58 views

Understanding offsets for continuous variables

I'm currently trying to write a linear model with data from some behavioural experiments with termites. I started to read Ben Bolker's "Ecological Models and Data in R", which has been a ...