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 program in `R`.

learn more… | top users | synonyms

0
votes
0answers
7 views

colnames with bigmemory object

I'm creating a big.matrix using the R package bigmemory, and in the documentation it states "If x has a huge number of rows and/or columns, then the use of rownames and/or colnames will be extremely ...
0
votes
1answer
22 views

gamm4 what does s() do?

say we have the following: ...
1
vote
1answer
23 views

How to check my data set is following non-linear to linear regression?

I have two data sets with y and X1,X2,X3,....,X6 all Xi's are independent variables and y is dependent variable. Instructor said that one data set will follow linear regression and other will follow ...
0
votes
0answers
14 views

Simulate time to event times based on an existing subset of data

I have to task to predict data volume to be processed for a study that currently has 40 patients, but will have 100 patients eventually. Since most of the data is generated during the treatment phase, ...
0
votes
0answers
12 views

Two-way Repeated Measures ANOVA with replicated measures

My experiment involves 16 participants with a dependent variable (PP) tested under 2 conditions, across 3 different time-points. At every time-point, each participant is tested twice. My data is ...
3
votes
1answer
43 views

Interpretation of odds in logistic regression

I have been reading the odds tutorial on UCLA's stats page. And I am trying to figure out if my interpretation of the results below is correct. Based upon looking at the data the results seem to hold ...
1
vote
1answer
16 views

does ANOVA have to work on groups with replicates? [duplicate]

I want to test if the means of different groups (tissue types) are different using one-way ANOVA. Most of the groups have replicates but there is one group that only has one sample. Like this: heart, ...
0
votes
0answers
8 views

How to control number of nodes which creating decision trees in r? [on hold]

I am new to R. I am working on generating a decision tree from my dataset using any of the libraries like rpart, tree and party. However, my task is to limit the number of nodes in the decision tree ...
0
votes
0answers
16 views

R Studio Server: Multiple AWS EC2 Nodes [migrated]

I can run code in parallel in R Studio using the ForEach and DoSnow packages. I can easily fire up a 32 core AWS EC2 instance running R Studio Server and run code in parallel using the following code: ...
3
votes
0answers
36 views

Why do my boostrapped CI's (using boot.ci in R) not include the point estimate?

I'm interested in estimating an average treatment effect $$ \operatorname{ATE}\left(A', A''\right) = \mathbb{E}\left( Y\ |\ A'' \right) - \mathbb{E}\left( Y\ |\ A' \right) $$ with a generalized ...
2
votes
1answer
41 views

Generate random data for logistic regression with a categorical independent variable

I am trying to generate a data frame of fake data for exploratory purposes. Specifically, I am trying to produce data with a binary dependent variable (say, failure/success), and a categorical ...
0
votes
0answers
18 views

prediction for data including weekly and annually seasonality and dummy variables for holidays

I have a three years of daily data for number of orders a trucking company receives everyday. Number of orders are high during weekdays and they have a huge decrease for weekend. I used msts to ...
0
votes
1answer
37 views

wrong predictions for weekend but good predictions for weekdays

I have a set of 3 years of daily data. I saw weekly and annual seasonality in the data so I used msts time series and tbats ...
1
vote
0answers
21 views

Proper normalized cross-correlation

I'm confused with the widely used approach to compute the normalized cross-correlation which is something like this: Standardize the argument vectors (of equal length $n$). Slide one over the other ...
0
votes
0answers
22 views

predicting time series with support vector machine using R

I am planning to do time series prediction using support vector Machine. I could not find any materials about time series application of support vector machines using R or Mat-lab. Similar question ...
0
votes
0answers
12 views

vif output for multicolinearity when you have factors

using vif(model) in R provides us with the variance inflation factors for out model. often people use sqrt(vif(model)) > 2 ...
0
votes
1answer
20 views

In a neural network of n features which predict a continuous variable X, how to tell the feature which contributes the most to the output value X?

Say I have a neural network which uses some input features say N, some inut layers say L which predict a continous variable say X. Can we say which features or combination of 2 features of the initial ...
0
votes
0answers
16 views

Analyses of mixed variables

I'm relatively new to statistics, and am currently working some data collected as a part of an interview survey. I have a response variable in ordinal form, which mostly looks into people's ...
0
votes
1answer
31 views

NA produced in linear regression model

I have read similar posts to this but my problem is not resolved by the answers given. I want to do a v simple linear regression to see if bite incidence is related to district, zone (vacc or control) ...
1
vote
0answers
30 views

Time series forecasting accuracy measures: MAPE and MASE

We come to this toy example showing MAPE and MASE are not consistent when measuring forecasting accuracy. Data consist of 100 white noise and 100 $AR(1)$ time series with length $N=500$, mean $\mu=1$ ...
0
votes
0answers
4 views

positive residuals after standardizing predictors in gls using R

I am using generalized least square in R. The original data I have seems to be OK when fitted with gls (judging from the residual vs fitted value graph). However, since I want to compare across ...
0
votes
0answers
25 views

Calculating probability of full house and royal straight in R poker simulation [migrated]

Given a poker simulation in R using vectors for the denomination and class of playing card in a loop, how would one go about identifying a given hand containing a full house or a royal straight. I'm ...
0
votes
0answers
8 views

Are there any packages to calculate accuracy, precision, recall and f-measure achieved by a KNN-classifier in R language? [on hold]

I have been trying to find packages to find accuracy,recall, precision etc performance metrics for the KNN-classifier. The closest I could find was caret but it says the object in its parameters has ...
-1
votes
0answers
48 views

Calculate the mean and variance of two random variables from their density functions

How do you calculate the mean and variance of two random variables X~F(m = 3, n = 6) and Y~F(m = 8, n = 6) from their density functions using R?
0
votes
0answers
9 views

Rescaling a variable in R [migrated]

I have a variable named Esteem that is in a scale 1:7. I would like to rescale it to 1:100. I understand that the R program scales can do so, however I am having problems with the syntax. Could ...
0
votes
1answer
11 views

Smoothing parameter for spline curve with duplicate points

I have body mass and age data for a population of individuals. I want to fit a cubic smoothing spline curve to the data. I'm using smooth.spline in R, which warns against using cross-validation to ...
0
votes
0answers
19 views

Analysis of mixed variables

I'm currently working some data collected as a part of an interview survey. I have a response variable in ordinal form, which mostly looks into people's perceptions of an animal, and a range of ...
0
votes
0answers
30 views

how to get theoretical center of distribution and theoretical variance of the distribution

Here for 1000 simulations and 40 samples for each, here is random exponential distributor using replicate function ...
0
votes
0answers
14 views

Cluster robust standard errors for the Hausman-Taylor estimator

Suppose I compute the Hausman-Taylor estimator using the plm command with the option: model= "ht". Using the result I like to obtain a robust variance-covariance matrix to make inference fully robust. ...
1
vote
1answer
62 views

Multiple regression in R with different data types of predictors

My goal is to investigate a dependent variable which is metric (time in hours). The independent variables include 3 metric, 2 binary (factors), and one factor variable, which consists of 11 districts ...
0
votes
1answer
20 views

plotting “log relative hazard” against continuous covariate: what are knots when using cph

I try to get into in Cox Regression and read the example chapter from Steyerberg's book. Afterwards I tried to plot log relative hazards against continuous variables using the rms package: ...
1
vote
2answers
28 views

Log-rank / Cox analysis with very unequal sized groups: alternative calculations of p-value?

I would like to set up a series of tests on the difference in survival between two very unequal sized groups. Generally either log-rank (using the R survdiff function) or a cox regression (R coxph) ...
0
votes
1answer
15 views

Multiple regression in R with different data types of predictors

My goal is to investigate a dependent variable which is metric (time in hours). The independent variables include 3 metric, 2 binary (factors), and one factor variable, which consists of 11 districts ...
0
votes
0answers
9 views

Testing variability in chromosome numbers at different taxnonomic levels?

Suppose I have a data set listing the chromosome count of a large number of species. Each species, in addition to chromosome count, have data on their Phylum, Order, and Family. I would like to know ...
0
votes
0answers
19 views

Code for type=“h” in ggplot2 [migrated]

This may sound really simple but I'm trying to find the equivalent code to plot(x,y, type="h") as a qplot code. I already have: ...
0
votes
0answers
28 views

Stock Closing price forecasting using ARIMA Model in R ( Entry level R programmer and Statistics learner)

I am an entry level R programmer and trying to learn statistics. i have downloaded the daily stock Adjusted Close price of one stock from sep 2011 to till date. As per my study plan, i have plotted ...
1
vote
0answers
17 views

How can you cluster a set of functions with unknown functional forms?

Say you've $N$ functions $f_N(x)$ defined on a regular grid $x$. You don't know the form of $f(x)$, you've only got several realizations of it. The different functions are related to each other ...
0
votes
1answer
23 views

Estimating Standard Errors for Markov Transition Probability with Multiple Observations (in R)

I was trying to estimate a Markov transition table from paired transition data, which look something like this: ...
0
votes
0answers
16 views

R, TukeyHSD or HSD.test into boxplot graph [on hold]

I am trying to make boxplots of TukeyHSD data or HSD.test data Currently my code looks like this: ...
1
vote
0answers
18 views

Performing a linear regression on small dataset and trouble with modeling small predictor values

I have a dataset. y: the dependent variable (representing a ratio between the number of objects bought with the given money & the total number of objects bought) x: the independent variable ...
0
votes
0answers
8 views

Caret: customizing feature selection using matrix-wise operations [migrated]

Short question: is it possible to use matrix-wise operations in caretSBF$score function? Motivation: When working with big matrices in R, operations that work natively matrix-wise [e.g. rowMeans(X) ...
2
votes
1answer
63 views

chi-squared test when variables dependent

For a square matrix, is it appropriate to use a chi-squared distribution when each level of the variables are assumed to have the same overall frequency? Specifically, I'm analyzing a dataset of the ...
0
votes
0answers
9 views

Regsubsets “Linear Dependencies Found” [on hold]

I've recently been getting used to using the leaps library in R, and the regsubsets method ...
0
votes
1answer
36 views

Calculate required sample size with R with known power and ratio of n1 to n2

If I know that d=0.8, sig.level=0.05, power = 0.8, ...
0
votes
0answers
11 views

Parallel multi-dimensional numerical integration in R

I am working on a problem that needs a numerical integration of a bivariate function, where each evaluation of the function takes about 1 minute. Since numerical integration on a single core would ...
2
votes
0answers
78 views

Machine Learning Algorithms, Depth of Understanding Vs Number of algorithms, [migrated]

Recently i was introduced to the field of Data Science (its been 6 months approx),and i started the journey with Machine Learning Course by Andrew Ng and post that started working on the Data Science ...
0
votes
0answers
31 views

Plotting histogram in R, error on stat=“bin”

I'm trying to plot day against number of migrations as a histogram in R, but I'm coming up with this error message: ...
3
votes
1answer
53 views

How are the p-values in the glmer (lme4) output calculated?

The output of models built using the glmer function in the package lme4 automatically includes p-values. What method does lme4 use to calculate these p-values? I can't seem to find this information ...
0
votes
0answers
28 views

data transponse in R [on hold]

sc_id sc_name testId Class_id subject marks SC_1 NET tst_1 cls_1 Mathematics 3 SC_1 NET tst_1 cls_1 Zoology 4 SC_1 NET tst_1 cls_1 ...
1
vote
1answer
64 views

Logistic Regression Odds Interpret

I was analyzing the different treatments applied to products. It started out with a a plethora of variables but I came to the conclusion that I can essentially only control the treatment applied so I ...