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

0
votes
1answer
12 views

Which predictors to choose and how to understand its output in R

I have to devise a model in R, capable of predicting the type of a disease, which is a categorical dependent variable (three possible values), through several continuous and categorical, some of the ...
0
votes
0answers
1 view

Inverse probability weighting (IPW): standard errors after weighting observations

When using propensity scores for inverse probability weighting (IPW) the standard errors for the parameters in the regression model may be affected. I have seen several examples of people using ...
-1
votes
1answer
18 views

Normal distribution in R: Find the value of $x$ for $P(X=x) = c$ where $c$ is known

I have a normal distribution with parameters $\mu=750$, $\sigma=260$. I'm interested in finding the value of $x$ that satisfies $P(X=x)=0.001$ for both sides of the tail. How would I go about doing ...
0
votes
0answers
12 views

How can I extract a residual variance-covariance matrix in lme?

I have been using MCMCglmm in R to fit bivariate (two response traits) mixed models in R, but now I need to move to lme to account for temporal autocorrelation of the residuals. In MCMCglmm I can fit ...
2
votes
0answers
14 views

Fitting nonlinear meta regression models to data

I have a collection of data, obtained from different studies. To plot the ratio of means against different CO2 concentrations, I used a random effects model with a continues predictor (the CO2 ...
0
votes
0answers
8 views

loop ordinal regression statistical analysis and save the data R [migrated]

I am relatively new to R. The short version of the data looks ike this: ...
0
votes
1answer
19 views

Multivariate OLS - Partialling Out

I have bee wondering why in a multivariate OLS-Regression it is not possible for R² to decrease when increasing the number of explanatory variables. The Point is that for example in the model ...
0
votes
0answers
9 views

How to choose which test to use to determine if a time series is non stationary?

I want to determine if my time series is non stationary. I looked many articles and have learned there is not just one formula - ADF. It seems you must use some series of tests and assumptions. But I ...
0
votes
0answers
10 views

Bayesian random effects meta-analysis on the risk ratio with r2jags

Following the work of Warn 2002 I am trying to set up the model for a Bayesian meta-analysis on the risk ratio and the odds ratio. I am using R together with R2jags to fit a simple RE MA model. ...
0
votes
0answers
10 views

Failed to reduce deviance while using “lme4 : glmer ”

this is my first post, so I will try to make it as clear as possible. Hopefully is not something trivial and I am just stuck. I am performing meta-analysis using the glmer function of the lme4 ...
1
vote
0answers
16 views

lavaan WARNING: could not compute standard errors!

I have a problem. I use r package "lavaan" to make confirmatory analysis. I run the following code: ...
0
votes
1answer
15 views

Forecasting with no seasonality

I have a set of data, let's say average weight of employees, captured every month over a period of 5 years (2010 - 2014). I cannot find a seasonality trend in the data over these years. Also, I have ...
0
votes
1answer
17 views

Functional clustering with R [on hold]

I have a time series data in R, and I am using functional clustering. I would like to interpret a figure that is output below the code. Furthermore, I would like to control line colors and thickness ...
0
votes
0answers
9 views

stepwise discriminant discriminant analysis with r [on hold]

how do a stepwise variable selection before the discriminant analysis, using the Wilks' lambda criterion, with r? can anybody show me the code? thx
0
votes
1answer
7 views

How to group data into already known centers of clusters in R?

I have a table of GPS data and I need to associate each record to the closest from a list of locations. It's like doing clustering but I already have the centers of the clusters.
0
votes
1answer
12 views

GAM summary F values

Does anyone know how the F values are computed in summary(gam.object). I've looked through the help page, and the gam package, ...
2
votes
0answers
17 views

Comparison of Bernstain and Chebyshev inequalities applied to Bernoulli distribution - simulation in R gives unexpected results

I'm trying to compare Bernstein and Chebyshev inequalities applied to Bernoulli distribution with parameter $p$. More specifically - how good are bounds they give for different sample sizes. I wrote ...
0
votes
1answer
9 views

How do I perform a Wald Test with multivariate Granger Causality Analysis

I am doing a Granger Causality Analysis for three economic variables (GDP, CO2 emissions and Total Energy Consumption) of Puerto Rico. I am using a Toda-Yamamoto Procedure implemented in R R. I am ...
0
votes
0answers
14 views

What does the sigma^2 figure mean when fitting a model to a time series in R?

I have a time series in R, and I am using the arima function to fit it to a SARIMA model. I would like to use the parameters it returns to write the time series equation by hand, but in order to do ...
0
votes
0answers
5 views

RSNNS neural networks, checking percentage correct.

For those who have some experience with RSNNS, I'm trying to build a neural network for reading aloud, using RSNNS in R. To give some information about what I'm doing and using. I'm using orthographic ...
1
vote
0answers
17 views

Overfitting of Regression with Robust Variances?

I performed regression with robust variances (after Stata 12.1 lnskew transformation). A question of overfitting has been raised. To summarise what I did: [1] Comparison of BrS (disgrp=2) vs ARVC ...
0
votes
0answers
8 views

Why are standard errors the same in lag-distributed model in R?

I am running a lag-distributed model ordinary least squares in which a set of units are all treated in the same year. I am including a 2 lags and 2 leads to see if there were any "anticipation" or ...
0
votes
0answers
12 views

Svm for survival analysis in r [on hold]

Is there any implemented package for survival analysis with SVM in R? I need to feed the model with both survival time and event. Thanks!
2
votes
0answers
23 views

Get survival rates from a cox regression in R

I am fairly new to survival analysis and am playing around in R. I have a fairly simple cox model ...
1
vote
0answers
10 views

Efficient Triangular Backsubstitution in R [migrated]

I am interested in solving the linear system of equations Ax=b where A is a lower-triangular matrix (n $\times$ n) and b is a (n $\times$ 1) vector where n $\approx$ 600k. I coded up backsubstitution ...
0
votes
0answers
10 views

How to minimize setup cost in linear programming model using R [migrated]

Suppose we have a matrix m: > m C1 C2 M1 70 80 M2 50 61 M3 45 40 with machines M1-M3 and customers C1-C2. The values indicated the product volume that each ...
0
votes
2answers
22 views

Tests of heteroscedasticity in linear regression models

I am unfamiliar with the implementation used in the R package GVLMA. What are some basic tests of heteroscedasticity in linear regression models and how or where ...
0
votes
0answers
18 views

How is the entropy calculated by the `entropy` package in R?

So, as per the docs, I'm calling the function like this v = c(0,4,3,6,7,3,2,3,4,5) entropy(discretize(v, numBins = 8, r = c(0,7))) and I get ...
0
votes
0answers
6 views

Convert coordinates to neighbor list for spatial analysis in R using INLA [on hold]

I am trying to do an analysis of two greyscale images taken a few seconds apart, where each pixel in the first image should be predictive of the pixel in the second image. In general pixels near each ...
3
votes
0answers
52 views

logistic regression in r with many predictors

I have been running logistic regression in R, and have been having an issue where as I include more predictors the z-scores and respective p-values approach 0 and 1 respectively. For example if have ...
0
votes
0answers
7 views

Using gbm to eliminate variables before glm

I have a classification problem I am attempting to model using logistic regression (via the glm package in R): ...
0
votes
2answers
31 views

Computing R-squared change, F-, and p-values for the interaction / moderation term [on hold]

I would like to compute R-squared change for the interaction/moderation term in a multiple regression model, along with the corresponding F- and p-values. Previously, I have worked with the modprobe ...
7
votes
2answers
200 views

nonlinear regression two equivalent models on paper, but different estimated parameters

I measured one response variable Y1 as a function of two measured independent variables X1 and X2 It is common practice in ...
0
votes
0answers
10 views

correct for temporal autocorrelation in mantel tests

Hej, I want to compare the community composition of a bacterial assemblage with it's resource use ability. therefore I calculate a distance matrix based on the community composition and a distance ...
2
votes
0answers
33 views

Simple importance sampling example: What am I doing wrong?

I am learning about importance sampling and trying undertake importance sampling on a trivial example, but failing to get the right answer. I have read various PDFs online, and the relevant section of ...
0
votes
0answers
32 views

What kind of data types are best to work with prediction algorithms of R

Assuming the data is tidy and it has a mix of columns of type numeric, character and Factor. What is the data type that would give best results when using different prediction techniques in R? I am ...
1
vote
0answers
22 views

Best SQL package for R [on hold]

I am starting programing in R and I am struggling with data manipulation. I am quite fluent in SQL so it would be easier if I could work with a SQL package. Which package would you advice? And why? ...
0
votes
0answers
27 views

Errors-in-variables multivariate polynomial regression (R)

(EDIT: the question has been modified just a little bit to be more specific) I want to fit a multivariate polynomial regression that accounts for measurement errors (an Error-in-Variables model). ...
0
votes
0answers
48 views

Marketing Data with many zeros

I am working on a marketing data which is a time series data with marketing spend done through different channels and revenue generated. The data looks like this : My data contains too many zeros ...
0
votes
1answer
23 views

What is a good test for comparing frequency counts between two groups?

I am looking for statistical methods used to compare frequency of observations between two groups. I have two geographical locations with data on different soil types present. for example, my data ...
0
votes
0answers
14 views

R and MATLAB: Line Plot with Layered Categorical Variables [on hold]

I'd like to reproduce the graph in the attached figure in R and MATLAB. Note that the x-axis contains categorical variables (hour and day). There could be multiple lines in the y-axis (e.g., the ...
2
votes
0answers
31 views

Spearman's rank correlation has p-value zero?

It looks like R's cor.test returns p-values of exactly zero if the real p-value is very low. For example: ...
0
votes
0answers
14 views

Prediction in mlogit [on hold]

I'm trying to use mlogit and predict the choices for my data. My data is: ...
0
votes
0answers
12 views

Permutation to test SNP interactions

sampleID case/ctrl var1 var2 var3 var4 var5... sample1 0 1 0 0 1 0 1... sample2 1 0 0 0 0 1 0... sample3 0 1 1 1 0 0 0... sample4 1 0 0 0 0 1 0... ... case/ctrl status is binary, variant status is ...
0
votes
0answers
20 views

R - Outlier detection multivariate in R [duplicate]

I'm looking for few R packages to detect outliers from a multivariate data frame. In the following Dropbox link you can find an example of data. Columns 1 to 5 are the variables and the 6th the label. ...
0
votes
0answers
2 views

Similarity measurement akin to SMAPE

I have two questions: A) Is there an official name for average of the smaller number over the larger number? B) Why have SMAPE range from 0 to 2? Isn't a range from 0 to 1 superior for understanding? ...
1
vote
0answers
7 views

Propensity score matching for “large” datasets - smarter solution than nearest neighbour?

The following question has some programming / software package as well as some numerical aspects, but I would consider it a statistical question at heart - I hope you agree. I am trying to do 1:1 ...
1
vote
2answers
39 views

Linear correlation between two sets of data

I have various data sets that correspond to values (in percentage) at given time points (hours, up to 10 hours). The total number of data sets of values at given time points is 8. My question is ...
0
votes
0answers
19 views

Getting an error message “Error in if(reached.threshold < min.reached.threshold)…” while training network using neuralnet package

I'm using R to create train and test a neural network on a time series (the annual sales of a company over a large period of time). As using the package's default learning algorithm (resilient ...
0
votes
0answers
15 views

Transforming independent variables in R [duplicate]

Is there a way through which we can determine how can we transform our independent variables to increase linearity. I am aware of boxcoz function but it provides information on transforming dependent ...