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`.

learn more… | top users | synonyms

-1
votes
2answers
42 views

Can PCA help me in determining effect of multiple variables on other variable? [duplicate]

I have a dataset containing 2000 soil property measured values and other attributes like slope, TWI, aspect, rainfall etc for the same. I want to see how my soil property changes with the change in ...
0
votes
0answers
5 views

How to get an azimuthal projection in an R plot? [migrated]

I want to use R for geospatial data analysis, and I want to use a map of my local area as from an azimuthal projection if possible. Is it possible to generate a map using R of an azimuthal projection ...
0
votes
0answers
13 views

Sample size calculation for study reduction by 50%

I need to calculate the sample size for a study with an aim of a 50% reduction in the incident of a disease post treatment. The numbers are as follows – Population – 10,000 Cases – 1200 Reduction ...
0
votes
0answers
4 views

Creating data partition in R [migrated]

When creating data partition 75% training and 25% test, we use: inTrain<- createDataPartition(y=spam$type,p=0.75, list=FALSE) Note: dataset is named "spam" and target variable is named "type" My ...
-1
votes
1answer
16 views

How to implement density-based clustering?

I’m looking to implement density-based clustering with R or Mathematica on a giant file (600,000 points on a 3 billion x 3 billion plane). Is DBSCAN the right method for data that is this sparse? I am ...
0
votes
0answers
11 views

Connect R to MySQL database with Standard TCP/IP over SSH Connection [migrated]

So the title says a lot about my current issue. I am currently connected to a MySQL database at my internship through a Standard TCP/IP over SSH connection. I am trying to connect R to this database ...
3
votes
1answer
33 views

Link functions for Binomial Regression

So I have a dataset of presence (1) and absence (0) data, but it mainly consists of 0's (~80% of the 5200 observations). Now while constructing my binomial logistic model I am reading (Zuurt et al. ...
0
votes
0answers
16 views

Plotting two normal distributions with overlap [on hold]

I'm trying to plot two normal distribution curves into one graph to show the overlap between them. My scenario is simple angle data from the heads of multiple fish split between males and females. ...
0
votes
1answer
17 views

drop1 LRT is zero in R

So for my current binomial model I am dropping some components and I found out that for one variable the results look a bit different. For 'hurseason' (class factor with two levels Y/N), the LRT is ...
0
votes
0answers
15 views

clustering for mixed data [on hold]

i'm student in statistics ( i'm sorry for my poor english)and i want do a clustering for a data that contains a groups of qualitative and quantitative variable, but i want do this in R and without any ...
0
votes
1answer
40 views

“Unable to resolve the following parameters:” jags error for Latent Class Model

I'm looking to fit a Bayesian latent class model in JAGS, but am running into an issue, which I'm seeking help to resolve. The model I'm trying to fit is described below (model details can be found ...
0
votes
0answers
8 views

Is there any Revolution R functions ( Rx) functions available for Survival Random Forest Analysis? [on hold]

I have R code which does Survival Analysis using Random Forests. It was taking huge amount of time. Is there any way to parallelize the operations using either Rev R Rx functions or any other way ?
1
vote
0answers
23 views

Classification trees - how to avoid “cherry picking”?

This post How to compare the performance of two classification methods? (logistic regression and classification trees) represents a very similar problem I am just trying to solve - I have a dataset ...
0
votes
0answers
10 views

R - create list with levels [migrated]

I have a dataframe with large number of categorical variables. I need to create a list, where I would get the output similar to str(DF), but not truncated Example: ...
2
votes
1answer
35 views

Should I use a mixed-effects model?. Measures at different locations in several pieces

Imagine a simple experiment: I have 10 "almost identical" pieces. I take the first one and I measure the temperature at 5 different distances from its center. I take the second one and I do the same ...
0
votes
0answers
19 views

How to simulate a dataset for linear modelling with a 3-level factor?

I am trying to simulate a dataset with a 3-level factor, and I hoped I could run some code by others to make sure I've not done anything wrong. The dataset is analysed in GLM with in R. The model ...
1
vote
1answer
13 views

Minimizing Single-Class Classification Error in R Trees

I'm running tree models in R to help define rules for predicting a binary outcome (0 or 1, of course). I understand mostly how to algorithm works, but I'm in a position where I don't really care about ...
2
votes
1answer
20 views

Fitting and interpreting random effects in repeated measures and unbalanced ecological data set

I have a vegetation data set that consists of 150 plots that were sampled 1-3 times over a three year period. Plots are my unit of observation and they are unbalanced (since plots were sampled either ...
0
votes
0answers
7 views

Error with `predict` function in var model with exogenous variables [on hold]

I am trying to get a 1-step ahead forecast in a VAR model with exogenous variables using the predict function in R. The code is a ...
0
votes
0answers
22 views

How can i find the contribution of each variable in gam model?

I am using gam models library (gcv) i have three parameters in the model: temperature, size and weight I want to get a how much % does each variable ...
0
votes
0answers
4 views

How can I use RLRsim to get for the results of a fitme() model (from the spaMM package)? [migrated]

I've found that the spaMM package fits my generalized linear models where others (e.g., lme4, glmmADMB) don't. Because my data is very uncooperative. I really need some kind of confidence intervals or ...
3
votes
1answer
237 views

Why doesn't my code for extracting the first principal component work?

Following the Wikipedia article on PCA, I extract the weights of the first principal component by calculating $$\textbf{w}_1 = \mathrm{\arg\ max} \left\{ \frac{\textbf{w}^\intercal \textbf{X}^\...
0
votes
0answers
11 views

r SMOTE return NA even the original data set contains no NA

I am trying to use SMOTE to tackle my imbalance data set. However, I don't know why it produced NA even though my original data set contains no NA. I also noticed the result is not even balanced. What ...
3
votes
1answer
28 views

How to implement MLE of Gumbel Distribution

I'm trying implement the Maximum Likelihood Estimation in R to Gumbel distribution, but the algorithm doesn't converge. I'm using this parametrization to gumbel: $${\frac {1}{\sigma}{{\rm e}^{{\...
0
votes
0answers
18 views

hclust anlyse methods, R

I use currently the function hclust() for Dendogram in R. It looks like: res.hc <- hclust(d, method = "ward.D2" ) My special interest is to understand, what ...
0
votes
0answers
16 views

Sample size needed for prediction modeling/validation with logistic regression

I have a dataset with about 30 potential predictors and 115 observations. I'm looking into building a prediction model with the data using logistic regression. From what I have read - the typical ...
0
votes
0answers
17 views

Likelihood Ratio Test p-value for three parameters in r

I have a function with 3 unknown parameters (theta1, theta2, theta3), defined as: ...
3
votes
0answers
27 views

Multilevel meta-analysis with non-independent effect sizes: correct model?

I'm conducting a meta-analysis on standardised mean difference scores. Some studies provide multiple effect sizes, thereby violating the assumption of independence. An example is given below (all ...
1
vote
1answer
32 views

Mixed factor both “within” and “between” subjects

I am wondering about experimental designs in which the levels of a factor are partly within and partly between subjects. Assume for concreteness that the experiment is as follows: The response ...
0
votes
0answers
11 views

Missing rows ANOVA in R [closed]

Why does the S:x1 column disappear (presumably S:x1 goes into ID but I dont know why)? S is a factor, x1 is a covariate and ID is a factor. ...
0
votes
0answers
36 views

Adjusting p-values of multiple correlations

I do a correlation test in r with cor.test over two matrices, M and A, the final correlation matrix is C. The cor.test provides a p.value or estimate. How should I correct for multiple testing the p....
0
votes
1answer
50 views

optimize a function in presence of NAs values in R

I would like to maximize the funcToOpt in the code. Description of the data: wb and X1 ...
0
votes
2answers
28 views

Spatial clustering in R with XY data

I have a matrix of data (215 rows, 618 cols) the data is xy positional data from a square surface. Most of the data is 0, and very few are 1. When I plot this data I see that the 1's form 2 small ...
0
votes
0answers
36 views

Critique on my Logistic Regression?

I've created a multivariate binary logistic regression web app using shiny and R for one of my final projects of the semester. I would like a little critique on it and would love to learn more of just ...
0
votes
0answers
3 views

How to do post hoc comparisons for mixed design ANOVA (BWW) in R?

Hi I'm running mixed design ANOVA analysis for a set of data. I have one between-subject variable and two within-subject variables. I used aov() command to do the analysis but Tukey() did not work for ...
1
vote
0answers
12 views

Linear model for testing a ratio of ratios

Our experimental design is as follows: For each of two genotypes (wt and ko), we perform two different gene expression assays (Assay1 and Assay2), and do 4 replicates of each assay. We are interested ...
0
votes
1answer
20 views

ln transformed data: how to report lme results in original units

I conducted an experiment to observe the effect a repeated treatment had on the concentration of protein in a set of samples. I have no formal training in statistics. My goal is to report how much ...
0
votes
0answers
17 views
0
votes
1answer
40 views

Time series prediction using ARIMA

I have a dataset which contains data from a sensor for every 5 minutes and am trying to predict for example 10 future values based on the first 500 values. My data looks like the following and could ...
0
votes
0answers
21 views

Use of Weights in Linear Mixed Models to improve error structure instead of transforming the Dependent Variable

I am runnning a Random Coefficient Mixed Model in R using lme in {lme4}. I had to transform ...
0
votes
0answers
19 views

Model design and nonconvergence problem with GLMM, incomplete block design in R

I have a two-part question that includes issues with generalized linear mixed models and failure to converge. First, a little bit about my experimental design. I have data where I am trying to test ...
0
votes
0answers
9 views

R: how to use Fourier or MCMC (or other type) to reconstruct the data?

i have this time series, with many missing data. The distribution of the data is monthly, with strong seasonality. I would to reconstruct, if is possible, the missing data. In a previous work (other ...
0
votes
0answers
20 views

R: Non-parametric model with random effects

I would like to generate a model like the example given below in R, but using a non-parametric method instead since the outcome protein (or transformations hereof) ...
0
votes
0answers
14 views

Hotelling T2 control in R [closed]

I have a dataset with 10 columns and many rows, these columns represent variables of data from a production line (measurements of data along as the product moves), each row is a part. I have standard ...
0
votes
0answers
25 views

Smaller residuals after transformation better?

This is a two part question concerning linear regression in R. Here is my code and what my residual plot looks like before transformation: ...
1
vote
0answers
35 views

How does R function summary.glm calculate the covariance matrix for glm model?

I would like to know how the covariance matrix of estimated coefficients is actually calculated. The code uses QR-decomposition and inversion of some sort. I have an idea that it would go something ...
2
votes
1answer
86 views

How to manually compute PCA transformation as performed by predict() following pcrcomp() in R?

How to manually compute PCA transformation as performed by predict() following pcrcomp() in R? Example: ...
0
votes
0answers
5 views

Obtaining the error between two time series with different size populations

In R, I have a time series X and a time series Y which is a representation of X after passing through an algorithm that reduces the number of points while trying to keep the general structure intact. ...
0
votes
0answers
4 views

Bayes factor for a logistic regression with a Randomized Response

I'm fitting a Bayesian logistic regression to model the effect of two covariates on a Randomized Response, with the 'rr' package. I would like to compare two nested models by using the Bayes factor. ...
0
votes
0answers
21 views

Probit with more than one instrument

I am estimating a probit model with instruments in R (using ivprobit). My simplified model looks like this: ...