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
0answers
3 views

In R package caret, how is linear regression model trained by using resampling?

Resampling is usually used to find the best tuning parameters for a model. However, for some models, such as linear regression model, there is no tuning parameters. In this case, what can we get from ...
0
votes
0answers
5 views

Replicate Scale=Pearson in SAS Proc Logistic using R

I am a former SAS user (no current license) and need to replicate results that I produced using Proc Logistic. I have substituted R and Python for SAS, and am ...
0
votes
0answers
5 views

Compute and plot similarity of binary document

I have a large matrix. It consists of about 10.000 rows (each row one document) and 10.000 columns (each column one word). The binary value indicates if a word exists (1) in the particular document or ...
0
votes
0answers
20 views

Unable to append row in R [on hold]

I trying to create a matrix with three columns and x rows. eveytime i try to append a row to the matrix i get this error. ...
1
vote
1answer
18 views

Creating a transition matrix for markov chain

I have a dataset with monthly frequency of observations that fall in each category, Cat. I would like to construct a transition matrix from this, i.e., from ...
0
votes
0answers
9 views

R caret package, tuning parameters using a data set

In R caret package, is there a way to tune training parameters using a specific (validation) data set instead of using ...
0
votes
0answers
20 views

Corresponding SAS mixed model in R

I am looking for the corresponding R model for the following SAS model. ...
1
vote
0answers
13 views

lme4 in R: how to specify 2 correlations with random intercept, without adding correlations between random slopes [on hold]

I am trying to specify a model in R's lme4 package in which I have 2 correlations between random intercept and random slopes, but the random slopes are not allowed to correlate. ...
2
votes
0answers
14 views

Detecting discontinuities in irregularly-spaced data

I am running physics simulations. Sometimes a simulation has insufficient resolution and produces discontinuities in the output variables. These are very easy to spot by eye in a scatterplot. I would ...
0
votes
0answers
26 views

Multivariate normal value standardization [on hold]

I am wonder how to standardize multivariate normal value and check that standardization gives correct result. This question is copy of mine from math section where I get no answear or idea about the ...
0
votes
0answers
18 views

How can I estimate weibull parameter in R? [on hold]

I'm new user of R. I have quantal response data with sampling test. Before sampling test decide sample size and sampling points. This data is test with '75' sample size and '20'sampling points. ...
2
votes
0answers
20 views

How to predict & plot quasipoisson GLM in R

I have a set of complex survey data with sampling weights. I am using the svyglm() function from the survey package in R to ...
0
votes
1answer
16 views

How to calculate distance between 2 lists in r with only general attribute information? [on hold]

I need to calculate distance between two simple lists in R and would like a little logic help please. The issue is that I do not have a data set, rather just a range for each attribute. Here's what I ...
1
vote
1answer
15 views

Incorrect class displayed when using 'apply' function in R [on hold]

I see a problem with the apply function in R. 1. This does not show the right class. ...
1
vote
1answer
17 views

What does the acf of the log of data tell us?

I'm working with time series data. And there is a use of acf ( auto correlation function ) being applied to the log of a ...
0
votes
0answers
4 views

How to plot identical slopes for an ANCOVA (1 categorical variable(2 levels) with 2 covariates) using ggplot2

I am trying to compare and plot regression lines of an ANCOVA when their slopes are the same and no interaction effect There are two sets of ANCOVAs plots that I am trying to create: a) 1 ...
0
votes
0answers
10 views

R and Eviews differences in ADF test

So I've implemented the ADF test in a large number of variables using eviews and R (urca package, ur.df). Althought the criteria used to select lags and the deterministic variables included were the ...
3
votes
1answer
52 views

What is the most appropriate way to transform proportions when they are an independent variable?

I thought I understood this issue, but now I'm not as sure and I'd like to check with others before I proceed. I have two variables, X and ...
0
votes
0answers
19 views

Metafor package: rma - How to get agreement with metan in stata when the confidence intervals are not symetric about the effect estimate

I would be extremely grateful for help with the following. I perform meta-analyses using effect estimates and confidence intervals. However, I can only get agreement between rma in R and metan in ...
1
vote
0answers
8 views

R Caret - Repeated CrossValidation, finalModel and ROC curves

I got a problem understanding the meaning of the finalModel when using a repeated CV. ...
0
votes
1answer
11 views

Test same coefficient from two different models in R

I am working with two ivreg models. The only difference between them is the choice of instruments on the other side of the line. Example: ...
0
votes
0answers
24 views

question about GBM [on hold]

...
1
vote
0answers
7 views

How to implement a SVAR with sign restrictions

I am trying to estimate a bi-variate sign-restricted SVAR with daily oil and stock prices and two shocks (demand and supply). The ultimate goal is to explain how much of the recent fall in oil ...
0
votes
0answers
14 views

If statement doesnt work [on hold]

When I run my code, then nothing happens. My data isnt modified as it should. My code: ...
0
votes
1answer
33 views

Multiple Correspondence / Correlation Analysis

I'm a little bit new to statistics, so I'm not sure what I really need. I have a table like the following with some categorical/nominal values (like Gender and Age Group) and a ratio scaled value ...
-1
votes
0answers
11 views

How to create a data subset by using a dynamic column name / variable? [on hold]

Why are dynamic column names not working in brackets? ...
0
votes
0answers
14 views

Statistical analysis for interaction of genes in multisamples

Say I have 120 human individuals. I have done gene-gene interaction in those individuals and found the frequency of all the interacting genes as shown in the data below. I want to do some analysis to ...
0
votes
0answers
16 views

Random effects in GAM [on hold]

I am now trying to use random effects in GAMs developed by Professor Simon Wood. Prof Wood uses s(...,bs="re") to account for the random effects. Random intercepts models or random slopes models are ...
1
vote
1answer
27 views

How to calculate confidence interval using parametric bootstrap

I was able to calculate the age-specific hazard ratio (HR) for breast cancer at age 40 and 60 years old. The HR was a continuous, piecewise linear function of age which was constant before 40 years, ...
0
votes
0answers
19 views

Face detection in R [on hold]

I'm trying to get started with this area (face detection) and I see a lack of information with R language. Are there any example or algorithm for face detection in ...
0
votes
0answers
19 views

beta regression creating a wild residual vs. fitted plot- whats going on?

I recently ran a beta regression model in R using the betareg package. I am modeling a continuous dependent variable (a fraction out of 1) that is bound between 0 ...
0
votes
1answer
22 views

R & propensity matching [on hold]

I am new to R & propensity matching. I doing a quasi-experimental study in which a group of 320 students received treatment and a group of 280 students did not receive treatment. I would like ...
0
votes
0answers
15 views

add legend to ggplot geom points [on hold]

I've created a ggplot indicating 3 different activities for male bats in three different colours: ...
0
votes
1answer
18 views

Negative BIC in k-means

Probably a simple question but I'm trying to interpret BIC for k-means. I have some k-means clustering and calculating BIC gives me a negative value, with a plot something like this: ...
0
votes
0answers
17 views

How to export my residual data? [on hold]

I am having a lot of trouble simply trying to export my residual data. I'm new to R so not sure what I'm doing wrong. I've tried doing library(xlsx) write.xlsx(Residuals, "c:/ResidualsData.xlsx") ...
0
votes
0answers
11 views

Is it possible to use color.scale to create color graded polygons in a polar.plot with plotrix? [on hold]

I have been trying to map sound levels in multiple directions from a single sound source. I have average dB readings from 45 degree intervals around the source. I have plotted these using the ...
0
votes
0answers
10 views

What is the best way to write an R data frame to a SQL Server database [migrated]

I have a data frame that I am trying to write to a table on SQL Server. The data frame contains only 8 of about 12 columns contained in the table and the columns in the data frame are not in the same ...
0
votes
0answers
14 views

TBATs - setting seasonal periods

I am looking to do some forecasting with multiple seasons and after a lot of research it looks like I'm going to test 4 different approaches. The first two will be Arima. One with xreg = dummy where ...
0
votes
0answers
3 views

Extracting significance score from AER coeftest results in R [migrated]

Calling coeftest(m) returns z test of coefficients: ...
-2
votes
0answers
18 views

How to apply a running function in R [on hold]

I need to develop a function in R which can be used to compute time varying variable P which is defines as: p(t)=k(t)*p(t-1)+j(t). ...
0
votes
0answers
23 views

How to update R version using code instructions? [on hold]

I want to write a program which automatically updates R to the latest version. Is there such instruction I can use for this task?
-1
votes
0answers
29 views

Wishart PDF for 1000 x 8 [on hold]

I have a dat aset which is composite of 1000 row and 8 column , how can i calculate the wishart pdf for covariance matrix ? what are the argument for the Wishart pdf in this case ?? ...
0
votes
0answers
13 views

Cross-validation results differ from package

I am trying to test out a hand-rolled cross-validation procedure for ridge regression. I've run the glmnet package which gives me an MSE bottoming out around ...
0
votes
0answers
11 views

What is the difference between the “+” operator in ggplot2 and the “%>%” operator in magrittr? [migrated]

What is the difference between the "+" operator in ggplot2 and the "%>%" operator in magrittr? I was told that they are the same, however if we consider the following script. ...
1
vote
0answers
23 views

How to estimate ratio of variances?

Suppose we have two time series generated by \begin{align} x_t &= \sigma_t\,e_t \\ y_t &= c\,\sigma_t\, f_t \end{align} where $e_t$ and $f_t$ are IIDs with mean zero and unit variance. We ...
1
vote
0answers
35 views

Testing 3-way interaction of categorical variables in a meta analysis in R

I'm currently working on a meta-analysis using the metafor package for R. I have several categorical moderators, a few of which are multi-category, that I'm including in the analyses. When using one ...
2
votes
0answers
32 views

Fit a scatter plot spline function

I am trying to fit a cubic spline through some data, while trying to reproduce results found in Generalized Additive Models: an introduction with R by S.Woods p125 (pg 138 of pdf), but I am not sure ...
0
votes
0answers
26 views

Dickey-Fuller test: conflicting results between SAS and R

I'm doing a Dickey-Fuller test on Airplane data in R. I'm using adf.test in "tseries" package and also doing this test in SAS. But SAS calculates p-value 0.2 and R ...
0
votes
0answers
6 views

McFadden pseudo R squared on GLM.NB

I have used the McFadden pseudo R squared on a negative binomial glm (family=poisson). I was wondering if it's appropriate. I have found informations suggesting McFadden is useful for poisson glm but ...