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

Specify a nested model in lavaan?

I am interested in fitting two models using the 'lavaan' package in R. I have a psychotherapy data set that has a nested structure - patients nested within therapists. I'm interested in fitting a ...
0
votes
0answers
22 views

A problem with predicted probabilities from a logistic regression [migrated]

I made a logit link, GLM model, in 2 ways. I want to know the chance to win according to these values, for example, for all combinations of these data. If I use expand.grid, I have the same chance ...
1
vote
1answer
47 views

Statistical analysis flowchart implementation in R

I have seen lots of flowcharts describing the different questions you should ask yourself when doing statistical analysis and the corresponding tests you should run based on your answer. For instance, ...
4
votes
2answers
67 views

Likelihood Ratio vs Wald test

From what I've been reading, amongst others on the site of the UCLA statistics consulting group likelihood ratio tests and wald tests are pretty similar in testing whether two glm models show a ...
0
votes
0answers
3 views

Regression line in ggplot doesn't match computed regression [migrated]

Im using R and created a chart using ggplot2. ggplot(Month.Data, aes(y=Measure, x=Samples)) +geom_point() + geom_smooth(method = "lm", se = FALSE) I then create ...
0
votes
0answers
13 views

Estimate dynamic panel data in R [closed]

I'm working with a balanced panel of macroeconomic data. In Judson&Owen(1999) I found that possible estimators are Andersona-Hsiao(1981), LSDVC derived from Kiviet(1995), Arellano-Bond (1991). How ...
0
votes
0answers
16 views

Estimate battery's real capacity in real time

The maximum capacity of a battery during usage can vary from manufacturer's specifications due to factors like temperatures and battery health. Because of that i want to estimate the real maximum ...
1
vote
0answers
11 views

How to estimate parameters of distrubution function where CDF data is known but no sample dataset [closed]

I would be very appreciated if someone help me. I have F(x) (Cumulative density) values for specific x values which is not equal interval but I have not any sample data to estimate parameters of ...
0
votes
0answers
18 views

How to interpret the result of tbats{forecast} in R?

If the values of alpha, beta and gamma are not Null it implies that the data has trend and seasonality. What does the negative value of beta or gamma implies? ex - gamma is: -0.0000038297240918093.
1
vote
1answer
91 views

Machine learning on dummy variables

I have a dataset on which there are about 1000 dummy variables indicating location. I do not have access to lat/long. I am using xgboost to train it. The more that I train it does seem to be lowering ...
0
votes
0answers
22 views

R : Time Series forecasting with TBATS [closed]

I have a time series dataset with daily values from 2013-10-01 to 2016-01-30. There is a clear monthly seasonality with months October, November recording higher traffic.I tried forecasting using ...
-3
votes
1answer
42 views

glm loop through grouped rows and and variable list? [closed]

Being quite new to R I am finding myself stuck once again. I have a dataset that looks like the following. ...
3
votes
1answer
54 views

Sample size for best forecasting ARIMA model

How can we decide the size or portion of the data given to get the ARIMA that has the best forecasting properties? I mean, for example, we have a hourly series with over 28.000 elements. Which is ...
0
votes
0answers
16 views

Understanding Multilevel graphs

Sorry for the simple question. Could someone help explain how I would describe the findings in multilevel model graph. I'm looking at between region variation in disease cases with temperature as ...
0
votes
0answers
25 views

ANOVA in R Help [closed]

I am new to this and was wondering if someone can explain to me how to get the answer for [c], [f], [g], and [h]. I understand how to get the answers for (A) , (B), (E), and (I) but theres a gap ...
0
votes
0answers
18 views

Fitting a model with time of day, day of week adjustment

I have one year's worth of clickstream data (like Minute, Numvisitors). I'm trying to see whether external events (commercials) affect ...
0
votes
0answers
23 views

How to estimate nonlinear equation in R [closed]

I'm trying to estimate the below nonlinear equation in R using the "Stats" package: Unfortunately, I keep receiving this error: ...
0
votes
1answer
34 views

Varying orders of integration - VAR/VECM model

I am building a VAR model, and have gotten a thorough set of guidelines through a question I asked a little while ago. However, I am left with some questions based on the following quote from Step 3 ...
0
votes
0answers
13 views

Finding proper cut off for filtering?

I had a set of data (149876 rows and 1200 columns)and I have found outliers points for each row. Now I want to determine a proper threshold for filtering my outliers. The distribution of my data is ...
2
votes
1answer
32 views

How to force exponential regression to go through an intercept? [closed]

Excel has a handy function that lets you set the y-intercept of an exponential regression model: How can the same effect be achieved using R? I'm using the following code: ...
4
votes
2answers
361 views

Why does the correlation function in R, cor() return a matrix with fewer rows that you started with?

I have a matrix $G$ in which I would like to compute the correlation matrix of. The matrix in R looks like: ...
0
votes
0answers
10 views

Barplot: axis label representation

I have a barplot as shown in the figures. On the ?barplot documentation they show how to increase the axis labels. Neverthless, in my case, the "main actors" are the labels itself. Suppose I want to ...
0
votes
0answers
44 views

Generating random variables from a density function expression with R? [duplicate]

I am using R langage, and for my algorithm I should generate random variables knowing the expression of the density function. For exemple, the density function is : ...
0
votes
1answer
28 views

Grouping usernames/emails in a data set

I have a column in a dataset that is the 'user'. Can look like this: tom green tgreen tomgreen@here.com sam blue samtha green How do i get this to group this so that the first three are grouped ...
0
votes
0answers
27 views

auto.arima from Forecast package for ARIMA (1, 0, X) model [closed]

I want to estimate a model(1, 0, X). The MA(X) in the model is selected on BIC. I have the following code on auto.arima ...
3
votes
0answers
15 views

Spatial Autoregressive Poisson model in R

I am estimating a gravity model of migration on cross-sectional data. The Moran I statistic indicates a positive and significant spatial autocorrelation in the residuals of the non-spatial model, and ...
0
votes
0answers
19 views

Limiting the number of autoregressive terms in ARIMA in R [closed]

I am using the below mentioned R code to implement a simple ARIMA process in R: forecast<-arima(log_visits_ts, order=c(3,0,1),xreg=reg,method="CSS") Question: ...
0
votes
0answers
41 views

Constrained regression and lagged factors

I have a model that I need to estimate, where I've seen a similar example (Constrained Regression in R: coefficients positive, sum to 1 and non-zero intercept) but without the second part of ...
0
votes
0answers
22 views

logistic regression - complete/quasi-separation

What is the implication if I don't fix a logistic regression that has complete or quasi separation? can I still read the marginal effects or are they not going to be valid? My exercise is actually ...
1
vote
0answers
37 views

How do I fit a linear regression model in R with interaction but with zero intercept?

I have an experiment where we measure the energy used by a building and want to regress this energy linearly against so-called degree-days, calculated with two different methods. The data looks like ...
0
votes
0answers
4 views

What is the R code to make predictor variables into matrix? [migrated]

What is the R code to make predictor variables into matrix? if: formula = liking ~ moisture + sweetness predictor variables are moisture and sweetness. now I want to calculate the coefficients by ...
0
votes
0answers
18 views

Use R to explore the properties of the sample variance [migrated]

I am attempting to learn statistics and R. I want to try the following question, and I think I need some guidance. Generate 1000 samples of size 5 from the standard normal distribution and compute ...
0
votes
0answers
21 views

Multiple categorical outcomes in R

I am trying to associate clinical signs with three disease outcomes. I have a list of 30 signs, each of which are a binary factor (present or absent, 1 or 0) as well as a few patient demographic ...
0
votes
0answers
29 views

Violating use of information in time-series forecasting

I am trying to forecast stock market returns using a rolling time frame. I want to fit a model on a 20 (trading-) day period and then predict one step ahead - the ...
0
votes
0answers
21 views

How to test whether my models are nested or non-nested?

I have built two models (linear probabilty and logit) in order to decribe certain variable. How can figure out whether they are nested or not? UPD The idea that I am pursuing is to measure how ...
0
votes
0answers
23 views

question in R programming [closed]

Use the concept and procedure of the Analysis of Variance to describe the basic practice of statistics, that is to separate effects from noise (or separate systematic components from the random ...
0
votes
0answers
9 views

Canonical correlation of discriminant analysis in R using CANDISC or MASS [closed]

How do you calculate or code to get the canonical correlation for a linear discriminant analysis using candisc or MASS in R?
0
votes
0answers
22 views

Forecast Daily Cash Flow

I am struggling with a forecast project. I have a time series of daily financial data for a personal account. The goal is to have a time series model for future daily cash flows. Right now,for better ...
1
vote
0answers
22 views

GLM Model Selection

I have to fit some data to a glm, family=poisson(link="log"). The response variables are X1, X2, X3 and X4. I need an algorithm to fit the best possible model (by lowest AIC). All terms must be ...
0
votes
1answer
22 views

Removing a principal component [closed]

What is the aim of removing a principal component from a data matrix and how would you do that in R?
0
votes
0answers
16 views

Linear model in R. Basics; how to read and understand the table [duplicate]

I am asked to fit a linear model for some data that my teacher has given. The first 5 lines of the R code is given by my teacher. X1 has 4 kind of outcome (1, 2, 3 and 4) and x2 has 6. I believe I ...
1
vote
1answer
48 views

Multiple regression in R results different to simple linear regression? [duplicate]

Hi I am having trouble acquiring the final results for presentation. The results from a multiple regression are different to my results in a simple linear regression. For example, the multiple ...
0
votes
0answers
22 views

Does a package submitted to CRAN need to meet minimum size requirements? [closed]

Looking through CRAN, I've found that most packages are fairly extensive. JBTools contains a few small functions, but it is still a collection of functions rather than one small function on its own. I ...
1
vote
0answers
36 views

How to specify a simple model in lmer/lme4: do I need explicit nesting?

I am measuring response time RT_log for 3 experimental manipulations (Conditions), and there are 4 ...
0
votes
0answers
27 views

New to R - generate all combinations and most likely combination [closed]

I'm just learning R and hitting a wall with my first script. I'm trying to simulate picking m&ms out of a bag (6 possible colors), 15 per bag, with certain probabilities. I've gotten as far as ...
0
votes
0answers
15 views

Drawing line graph in R [closed]

I am very new to R and would like to draw a line graph. I have got as far as importing my data into R and don't really know where to go next! I've searched the internet for examples of how to plot a ...
0
votes
0answers
8 views

function with loop bootstrapping [closed]

I need help with writing a function, which tests via bootstrapping whether the mean in a particular vector is > 100. vector: s e t . s e ed ( 1 ) x <- r u n i f (80 , min = 80 , max = 125) Then, i ...
0
votes
0answers
19 views

Multilevel model using negative binomial

I'm trying to look at between region variation (5 regions in total) in disease cases and the influence of climatic factors. How do interpret the variance given such a small value i.e variance when ...
0
votes
0answers
16 views

Plotting a box plot with subcategories in R [migrated]

I would like to plot a box plot with subcategories using ggplot2. For example, p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot() gives me 3 ...
0
votes
0answers
13 views

Fuzzy c-mean clustering (FCM) [migrated]

From these two results for fuzzy c-mean clustering : ...