using betareg in coding with R - r

I am a beginner in R and I am supposed to make a model thanks to regression beta. I learned that I can use betareg() except that even when installing its package the R does not recognize it and displays me error:
Error: could not find function "betareg"
What could be the cause for that?

The error message you are getting typically arises when calling a function.
Before you can call a function, you have to install the package and load the library.
You can try this:
install.packages("betareg")
library(betareg)
and then call the function with relevant parameters
betareg()

Related

Autospearman in R

Did anyone used the AutoSpearman function from "software-analytics/Rnalytica" package and worked for him? I keep having errors while loading the package. You can find here the documentation of AutoSpearman function.

ts_backtesting function from TSstudio is not showing in the list of functions in TSstudio package in R

I have been trying to perform the horse approach for finding the best model to run on the time series data but when I run ts_backtesting function, there is a message in console that
Error in ts_backtesting(x) : could not find function "ts_backtesting"
Can anyone please help me know why I am getting such error and how to avoid that.
I checked the latest version of the package, didn't find this function anymore
https://cran.r-project.org/web/packages/TSstudio/index.html,
instead, a function called 'train_model' can be used to do a similar thing.

Is there a function check_rhat() in rstan package?

In the following page, I find a function check_rhat(). However in the R console, there does not exist even if using rstan:::.
So, I made a similar function for diagnosis of rhats in my package, but, if there exist some function to evaluate the rhat I want to use it (if it exists).
https://betanalpha.github.io/assets/case_studies/divergences_and_bias.html
That function comes into the R session via source("stan-utility.R") and is defined here. It is not in the rstan package.

Julia: pcaeig(X) yields "UndefVarError: fliplr not defined"

I am trying to get the eigenvector to do pca (principal component analysis). The package, DimensionalityReduction.jl offers a command that should do that very thing, pcaeig(X) where X is some matrix. My code is as follows
using DataFrames
using DimensionalityReduction
data = readtable("Midterm Data.csv")
T=size(data)[1]
n=size(data)[2]
erates = convert(Array,data[1:T,2:n])
eigvec = pcaeig(erates)
I do apologize that the formatting is bad, I don't quite remember how to put the code in a quote. Anyways, when I try to run this code, I get the following error: "UndefVarError: fliplr not defined". Now, to my knowledge, fliplr is a command used to flip a matrix (not a variable). It is also saying that the error is happening in the code for the package (not my code). Does this mean that I am out of luck and cannot use this package until it gets patched? If so, does anyone else know another method to get the eigenvector for pca?
As it says in the README of DimensionalityReduction, the package is deprecated:
The DimensionalityReduction package is deprecated. It is superseded by a new package MultivariateStats.
The package does not work on recent versions of Julia and will not be updated to do so in the future. Use MultivariateStats instead.

How to prevent R from trying to load mgcv

I need to run 2 different scripts in R without restarting the session. In the first i use the package mgcvand in the second i need gam. I wrote a script which detaches and removes the package mgcv and installs and loads gam.
But still after i want to run the gam() function I get an error telling me that mgcv was not found. Which I interpret as R looking for the mgcv package for installing it...
Here's a MWE:
install.packages(paste(path.pkgs,'mgcv_1.8-7.zip',sep=''),repos=NULL)
require(mgcv)
## FIRST SCRIPT ##
detach(package:mgcv)
remove.packages('mgcv')
unloadNamespace('mgcv')
require(gam)
## SECOND SCRIPT ##
gam(as.formula(t.thr.fm),data=data)
which returns the error:
Error in get(method, envir = home) :
cannot open file 'H:/data/Documents/R/R-3.1.3/library/mgcv/R/mgcv.rdb': No such file or directory
Any ideas instead of restarting the session?
EDIT:
The solution suggested by Floo0 using package::function is unfortunately not an option.
you can tell R to take a function from a specific package via this syntax:
package::function
So in your case (do not detach mgtv) and use
mgcv::gam(...)
gam::gam(...)
If the function is not exported in the namespace of the function you can also try package:::function with 3 :

Resources