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
12 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
13 views

Random effects in GAM

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 ...
0
votes
0answers
1 view

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
9 views

Best Measures for face detection [on hold]

I'm trying to evaluate series of face detection algorithm. For that I need the best protocol or measures to distinguish each algorithm. As output I only have the number of faces detected (until ...
0
votes
0answers
11 views

Clustering Matrix with binary values

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
16 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
16 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
20 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
14 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
17 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
15 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
8 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
11 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
17 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
20 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
26 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
11 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
27 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
29 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
22 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
4 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 ...
0
votes
0answers
11 views

Bonferroni correction after hypergeometric test

I have a small doubt regarding a Bonferroni after running an hypergeometric test on genomic data. Let say I have a population of 379876 output data(integer numebers), and this population is clustered ...
1
vote
0answers
8 views

What is the appropriate statistical test to perform a difference of means within a difference of means?

Let's say I am interested in measuring the effect of three different types of interventions on test scores. Let's say the intervention is book quality, of which there are three kinds of book quality ...
1
vote
2answers
31 views

auto.arima not giving the best model according to information criteria

I'm using auto.arima to get the best model for the MASS dataset deaths. However, ...
0
votes
0answers
14 views

How do I compute the posterior distribution of the success probability with uniform priors?

This is a question from a homework assignment A clinical trial is conducted to compare the effectiveness of three drugs. 100 patients are randomly assigned to each drug (300 total patients), and Y_1 ...
0
votes
0answers
33 views

Statistics help required [on hold]

I am doing a project in A/B testing.I want statistical approach to evaluate my work. A/B testing is comparing two versions of a web page/ taglines /landing pages to see which one performs better. You ...
0
votes
0answers
25 views

How to fit a curve for a histogram [on hold]

I am trying to fit a curve (gaussian) for my distribution represented here with an histogram, like the red curve represented in the attached shema. X = rchisq(1000, df = 5) hist(X) Thank you
0
votes
0answers
9 views

Planned contrasts in ezANOVA

I have a data set that is 3 x 5 and I can easily run a repeated measures ANOVA using ezANOVA in R. I now wish to have planned contrasts going into the ANOVA. The data consists of one control ...
1
vote
1answer
52 views

Statistical significance in time series (R)

Stats newb here, I have to determine if two time series are really different instead of being part of the same population with noise in the samples. The data is a comparison between two algorithms ...
0
votes
1answer
15 views

SOM (Kohonen) using the term document matrix [on hold]

Language: R Package: kohonen Function: som I have a term document matrix (tdm) with 64 terms (row) and 1017 documents (columns). I want to use the self-organized-map to cluster the terms on 25 ...
0
votes
0answers
12 views

Filling a Matrix on the basis on data in two columns [on hold]

I have a following matrix M - A B C D A 0 0 0 0 B 0 0 0 0 C 0 0 0 0 D 0 0 0 0 and Data Frame - DF C_Name F_Name Sam A Sam D Sam C Tom C Tom ...
0
votes
0answers
5 views

How to incorporate intraspecific variation in discrete characters in comparative analysis?

I'd like to run a multivariate analysis (Pavoine et al. 2011) that aims to disentagle the effect of environmental gradients on traits, considering its autocorrelation with phylogeny and space. It uses ...
0
votes
0answers
22 views

Is there a variable selection function in R or Stata for Tweedie regression?

I have a data which includes 8 variables: 1- The first variable contains grades given by a voice expert to participants' voices. It takes any value from 0 to 3 with mode 0 (so zero inflated) 2- The ...
4
votes
0answers
75 views

How to analyze trend in non-periodic time series

Suppose I have following non-periodic time series. Obviously the trend is decreasing and I would like to prove it by some test (with p-value). I am unable to use classic linear regression due to ...
0
votes
0answers
21 views

Normalize sum(case when..) [on hold]

In Netezza I ran the following query to make the nominal variables into binomial ones and sum them up: sum(case when c.COUNTRYCODE = 'US' then 1 else 0 end) as US ...
0
votes
0answers
10 views

ordinal logistic regression with time series

At several time points, I sample different individuals from a population (say 60 ind/time point). I assign to each of them one category (either low < middle < high). I then want to model this ...
0
votes
0answers
11 views

Loss function selection for weighting errors differently

I am building a regression model where I want to score/optimize/train 'over-predictions' to be twice costly as under predictions. I am attempting to do this in R and hopefully with caret package. ...
1
vote
0answers
32 views

R Poisson process simulation for a queuing problem [on hold]

I'm working on the problem - patients come into a clinic according to a Poisson process with time parameter 10 minutes starting from 9 am until 4pm when the clinic stops admitting new patients. There ...
0
votes
0answers
24 views

Creating Naive Bayes Model for numerical data in R

I want to calculate the missing value using the NaiveBayes predictor. I am using a dataset with missing values at some rows, ...
1
vote
1answer
49 views

GLMM or LME? Repeated measures help?

I am having trouble using the correct test and r code for my experiment. Essentially I measured insect emergence daily from artificial streams with 3 treatments.: ...
0
votes
0answers
11 views

Predict function in r - time series

I have built a model on my training dataset where I have used the difference of the log(Y) i.e. diff(log(Y)) as my response variable. Now if I want to use this for predicting the Y variable in my ...
0
votes
0answers
21 views

Selecting Subset of Quantitative Variables in R [on hold]

Is there a way to generate a subset of my quantitative variables in R, without having to manually select them in the subset() command? I have very many quantitative variables, and it would be too time ...
2
votes
0answers
17 views

Optimal methods for bandwidth selection in kernel density estimation

I am looking for help in choosing a suitable method for bandwidth selection in kernel density estimation. I have six data sets with 50 to 200 observations each and aim to fit a continuous univariate ...
1
vote
0answers
22 views

Transformation of data with zero and R squared

I have a conceptual concern about data tranformation and R^2. Often we transform data to respect the assumption of the linear model. Therefore, we can use multiple type of transformation such as log ...
0
votes
0answers
18 views

Test for identifying structural breaks in daily financial time series data

I have daily data of Nifty from 2002 Jan 08 to 2014 March 31. I am trying to identify structural breaks in my data. I shall be very thankful if anyone can guide me as to what test shall I apply to ...
0
votes
0answers
33 views

How to use LDA results for prediction? And how to assess model fit?

I am trying to understand how to interpret the results I get from LDA. Running from the iris dataset in R, I can see the discriminant coefficients are in the model and then I can plot the model to ...